Post

Replies

Boosts

Views

Activity

Rare EXC_BAD_ACCESS (SIGBUS) KERN_PROTECTION_FAILURE crash when running function?
The following function could run several hundred times with no problem but will occasionally cause a EXC_BAD_ACCESS (SIGBUS). The last time it was a KERN_PROTECTION_FAILURE perhaps meaning it is trying to write to a read only memory but previously it was KERN_INVALID_ADDRESS. I have tried debugging tools to no avail. Can anyone see any reason why the following function could be causing this. Just in case the function is a red herring the only other thing that was running is a AVQueuePlayer that contains 11 tracks, but the crash happens mid song making it unlikely. The function includes running other functions so below is all related functions that happen as a result of a swipe gesture. func completeLeft() { let add1 = Int(tiles[Square - (squares2move + 2)].name ?? "0") ?? 0 let add2 = Int(currentNode.name ?? "0") ?? 0 let add = add1 + add2 if add.isMultiple(of: 9) == false { if squares2move == 0 { self.moveinprogress = 0 return } moveLeft1() } if add.isMultiple(of: 9) { squares2move += 1 moveLeft2() } func moveLeft1() { var duration = TimeInterval(0.1) duration = Double(squares2move) * duration self.soundEffect = "swipe" self.playEffects(Volume: self.effectsVolume) let move = SKAction.move(to: positions[Square - (squares2move + 1)], duration: duration) currentNode.run(move, completion: { self.tiles[Square - (squares2move + 1)].name = self.currentNode.name self.tiles[Square - 1].name = "" self.currentNode.position = self.positions[Square - (squares2move + 1)] self.newNumber() }) } func moveLeft2() { var duration = TimeInterval(0.1) duration = Double(squares2move) * duration self.soundEffect = "swipe" self.playEffects(Volume: self.effectsVolume) let move = SKAction.move(to: positions[Square - (squares2move + 1)], duration: duration) currentNode.zPosition = currentNode.zPosition - 1 currentNode.run(move, completion: { self.currentNode.position = self.positions[Square - (squares2move + 1)] self.tiles[Square - 1].name = "" self.currentNode.name = "\(add)" self.tiles[Square - (squares2move + 1)].name = "\(add)" if add > self.score { self.score = add } if add > self.currentgoal { self.levelComplete()} else { self.playEffects2(soundEffect: "Tink", Volume: self.effectsVolume, Type: "caf")} if self.currentNode.childNode(withName: "Label") == nil { self.currentNode.texture = SKTexture(imageNamed: "0.png") let Label = SKLabelNode(fontNamed: "CHALKBOARDSE-BOLD") Label.text = "\(add)" Label.name = "Label" let numberofdigits = Label.text!.count if numberofdigits == 1 { Label.fontSize = 45 * self.hR} if numberofdigits == 2 { Label.fontSize = 40 * self.hR} if numberofdigits == 3 { Label.fontSize = 32 * self.hR} if numberofdigits == 4 { Label.fontSize = 25 * self.hR} Label.horizontalAlignmentMode = .center Label.verticalAlignmentMode = .center Label.fontColor = .systemBlue Label.zPosition = 2 self.currentNode.addChild(Label) self.currentNode.zPosition = self.currentNode.zPosition + 1 var nodes = self.nodes(at: self.positions[Square - (squares2move + 1)]) nodes = nodes.filter { $0.name != "Tile" } nodes = nodes.filter { $0 != self.currentNode } nodes = nodes.filter { $0 != self.currentNode.childNode(withName: "Label") } for v in nodes { v.removeFromParent()} } else { let Lbl = self.currentNode.childNode(withName: "Label") as? SKLabelNode Lbl!.text = "\(add)" let numberofdigits = Lbl!.text!.count if numberofdigits == 1 { Lbl!.fontSize = 45 * self.hR} if numberofdigits == 2 { Lbl!.fontSize = 40 * self.hR} if numberofdigits == 3 { Lbl!.fontSize = 32 * self.hR} if numberofdigits == 4 { Lbl!.fontSize = 25 * self.hR} self.currentNode.zPosition = self.currentNode.zPosition + 1 var nodes = self.nodes(at: self.positions[Square - (squares2move + 1)]) nodes = nodes.filter { $0.name != "Tile" } nodes = nodes.filter { $0 != self.currentNode } nodes = nodes.filter { $0 != self.currentNode.childNode(withName: "Label") } for v in nodes { v.removeFromParent()} } self.moveinprogress = 0 }) } } func moveLeft() { var duration = TimeInterval(0.1) duration = Double(squares2move) * duration self.soundEffect = "swipe" self.playEffects(Volume: self.effectsVolume) let move = SKAction.move(to: positions[Square - (squares2move + 1)], duration: duration) currentNode.run(move, completion: { self.tiles[Square - (squares2move + 1)].name = self.currentNode.name self.tiles[Square - 1].name = "" self.currentNode.position = self.positions[Square - (squares2move + 1)] self.newNumber() }) }
0
0
176
Mar ’25
Can personal information be taken from creatorUserRecordID in a CKrecord?
I am using cloudkit to save users high scores in a public database. The preference over using Game Center is because of simplicity and works really well for what I want to achieve. I simply want to let users know their global position. Because of data privacy laws the app asks the user for their permission to submit their score each time they get a new high score. However, I have noticed that CKRecords under 'created' and 'modified' in addition to UTC time and date also contain creatorUserRecordID. Could this be a privacy issue? Can you extract any personal information from this? Can this be used to track back to the user? Is it linked to CKUserIdentity which I understand does contain personal information, although as I understand you need users consent to get this information. Under creatorUserRecordID it says... "Every user of the app has a unique user record that is empty by default. Apps can add data to the user record on behalf of the user, but don’t store sensitive data in it" Currently I simply ask the user if they are happy to submit their score. But do I need to point out that it also stores a creatorUserRecordID? Obviously I don't want to do this if it is not needed as the user will 1) Probably not understand what a creatorUserRecordID is and 2) It makes the question complicated and will likely make most people refuse to submit their score. If it is a privacy issue, is there anyway to stop a CKRecord creating this ID and simply save a score? All I need is a list of scores so the app can determine their current position. If creatorUserRecordID does not contain any personal details and cannot be tracked back to the user please let me know, so I can be reassured that my current set up is fine and I am not causing any privacy issues! This post did seem to indicate you may possibly be able to fetch personal details?? https://stackoverflow.com/questions/55782166/how-do-i-fetch-any-info-about-user-that-modified-ckrecord
3
0
270
Mar ’25
Swift motion tracking
Is there a way to copy the recorded co-ordinates of motion tracking in a video to the motion curve of an image overlay? I want an image to follow a point in a video. If cannot be done within swift. Can you use motion tracking in apple motion software and use the co-ordinates or saved animation curve and somehow apply to an image in swift? Would be extremely time consuming to copy each co-ordinate one by one !! Thanks
0
0
461
Jun ’20