I have a simple class func for adding SKEmitterNode on many different occasions.
I cannot reproduce steps when the exception occurs. It happens rarely and quite randomly. I can call this method 500 times without an error or in some cases error can happen after 1 or 2 call, etc.
The problem/exception line is:
root?.addChild(sparks)
Below is the method and stack trace. I have no idea how to debug this. I've tried many different things but without success.
Any ideas ?
class func setSimpleSparksEffect(root:SKNode?, color:UIColor, position:CGPoint)
{
if CGPointEqualToPoint(position, CGPointZero)
{
return
}
let sparks = SKEmitterNode(fileNamed: "SimpleSparks")
sparks.alpha = GameObjectsDefaultAlpha
sparks.particleColorSequence = nil
sparks.particleColorBlendFactor = 1.0
sparks.particleColor = color
sparks.position = position
sparks.zPosition = SparksElementsZPosition
root?.addChild(sparks)
sparks.runAction(SKAction.waitForDuration(NSTimeInterval(EmmiterSimpleShortDuration)), completion: { () -> Void in
sparks.runAction(SKAction.fadeOutWithDuration(NSTimeInterval(FactorSparksFadeOutDuration)), completion: { () -> Void in
sparks.removeAllActions()
sparks.removeAllChildren()
sparks.removeFromParent()
})
})
}
And stack trace:
Thread : Crashed: com.apple.main-thread
0 libc++abi.dylib 0x0000000199944ce4 __dynamic_cast + 52
1 SpriteKit 0x000000018ab63f58 __15-[SKNode scene]_block_invoke + 60
2 SpriteKit 0x000000018ab63f58 __15-[SKNode scene]_block_invoke + 60
3 SpriteKit 0x000000018ab28038 SKCNode::walkUp(void (SKCNode*, bool*) block_pointer, bool) + 76
4 SpriteKit 0x000000018ab63eac -[SKNode scene] + 132
5 SpriteKit 0x000000018ab643ac -[SKNode insertChild:atIndex:] + 356
6 SpriteKit 0x000000018ab64224 -[SKNode addChild:] + 76
7 DodgeMaster 0x00000001000f1d80 static DodgieCommon.setSimpleSparksEffect(SKNode?, color : UIColor, position : CGPoint) -> () (DodgieCommon.swift:275)
8 DodgeMaster 0x00000001000d2bc4 GameLevel.(gameLogicGoalerHitmeContact(GameLevel) -> (NSNotification) -> ()).(closure #1) (GameLevel.swift:502)
9 DodgeMaster 0x0000000100125018 static Helper.(runAsyncOnMain(Helper.Type) -> (() -> ()) -> ()).(closure #1) (Helper.swift:270)
10 DodgeMaster 0x00000001000b41c4 thunk (Pointoser.swift)
11 libdispatch.dylib 0x000000019aa917b0 _dispatch_call_block_and_release + 24
12 libdispatch.dylib 0x000000019aa91770 _dispatch_client_callout + 16
13 libdispatch.dylib 0x000000019aa96e20 _dispatch_main_queue_callback_4CF + 1844
14 CoreFoundation 0x000000018574c258 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
15 CoreFoundation 0x000000018574a0c0 __CFRunLoopRun + 1628
16 CoreFoundation 0x0000000185678dc0 CFRunLoopRunSpecific + 384
17 GraphicsServices 0x00000001907cc088 GSEventRunModal + 180
18 UIKit 0x000000018ad52f60 UIApplicationMain + 204
19 DodgeMaster 0x000000010011de24 main (AppDelegate.swift:22)
20 libdyld.dylib 0x000000019aac28b8 start + 4
Another person on here had a similar problem which I think you may encountering too... I've tailored my response on that post for yours.
let sparksFile: String = NSBundle.mainBundle().pathForResource("SimpleSparks", ofType: "sks")!
let sparks = NSKeyedUnarchiver.unarchiveObjectWithFile(explosionFile) as! SKEmitterNode
sparks.alpha = GameObjectsDefaultAlpha
sparks.particleColorSequence = nil
sparks.particleColorBlendFactor = 1.0
sparks.particleColor = color
sparks.position = position
sparks.zPosition = SparksElementsZPosition
self.root?.addChild(sparks)
Related
This is what appear in crash log for crashlytics:
Crashed: com.apple.main-thread
0 FieldService 0x665cc specialized MonthNameFormater.stringForValue(_:axis:) + 4304774604 (GraphViewController.swift:4304774604)
1 FieldService 0x5fd74 #objc MonthNameFormater.stringForValue(_:axis:) + 4304747892 (:4304747892)
2 Charts 0xcc4c AxisBase.getFormattedLabel(_:) + 149 (AxisBase.swift:149)
3 Charts 0xcaa8 AxisBase.getLongestLabel() + 138 (AxisBase.swift:138)
4 Charts 0xb0c78 XAxisRenderer.computeSize() + 158 (XAxisRenderer.swift:158)
5 Charts 0xb0b3c XAxisRenderer.computeAxisValues(min:max:) + 154 (XAxisRenderer.swift:154)
6 Charts 0x1cb9c BarLineChartViewBase.notifyDataSetChanged() + 592 (:592)
7 Charts 0x57ee8 ChartViewBase.data.didset + 656 (:656)
8 Charts 0x54750 ChartViewBase.data.setter + 84 (:84)
9 FieldService 0x62368 GraphViewController.updateGraph() + 4304757608 (:4304757608)
10 FieldService 0x610e0 closure #1 in closure #1 in GraphViewController.viewDidLoad() + 4304752864
11 FieldService 0xb2000 thunk for #escaping #callee_guaranteed () -> () + 4305084416 (:4305084416)
12 libdispatch.dylib 0x1e6c _dispatch_call_block_and_release + 32
13 libdispatch.dylib 0x3a30 _dispatch_client_callout + 20
14 libdispatch.dylib 0x11f48 _dispatch_main_queue_drain + 928
15 libdispatch.dylib 0x11b98 _dispatch_main_queue_callback_4CF + 44
16 CoreFoundation 0x51800 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
17 CoreFoundation 0xb704 __CFRunLoopRun + 2532
18 CoreFoundation 0x1ebc8 CFRunLoopRunSpecific + 600
19 GraphicsServices 0x1374 GSEventRunModal + 164
20 UIKitCore 0x514b58 -[UIApplication _run] + 1100
21 UIKitCore 0x296098 UIApplicationMain + 364
22 FieldService 0x6b74 main + 20 (AppDelegate.swift:20)
23 ??? 0x1018a9da4 (Missing)
As you can see, a lot of users is impacted with it.
And this is my class called MonthNameFormatter. What and where is the issue?
import Charts
import CoreData
class MonthNameFormater: IndexAxisValueFormatter {
override func stringForValue(_ value: Double, axis: AxisBase?) -> String {
let symbols = Calendar.localizedCurrent.shortMonthSymbols
let index = min(Options.shared.isTheocraticYearEnabled ? (Int(value) + 8) % 12 : Int(value), 11)
guard symbols.count == 12 else {
return "-"
}
return symbols[index]
}
}
Where do I use it in code?
private let chartView: LineChartView = {
let view = LineChartView()
view.xAxis.labelPosition = .bottom
view.rightAxis.enabled = false
view.borderLineWidth = 0
view.xAxis.valueFormatter = MonthNameFormater()
view.xAxis.granularity = 1
view.isUserInteractionEnabled = false
return view
}()
This is an info from Xcode
Thread 0 name:
Thread 0 Crashed:
0 FieldService 0x0000000104f665cc Swift runtime failure: Index out of range + 0 (:0)
1 FieldService 0x0000000104f665cc specialized _ArrayBuffer._checkInoutAndNativeTypeCheckedBounds(_:wasNativeTypeChecked:) + 0 (:0)
2 FieldService 0x0000000104f665cc specialized Array._checkSubscript(_:wasNativeTypeChecked:) + 0 (GraphViewController.swift:0)
3 FieldService 0x0000000104f665cc specialized Array.subscript.getter + 0 (GraphViewController.swift:17)
4 FieldService 0x0000000104f665cc specialized MonthNameFormater.stringForValue(_:axis:) + 744
5 FieldService 0x0000000104f66498 specialized MonthNameFormater.stringForValue(_:axis:) + 436 (:0)
6 FieldService 0x0000000104f5fd74 MonthNameFormater.stringForValue(_:axis:) + 4 (:0)
7 FieldService 0x0000000104f5fd74 #objc MonthNameFormater.stringForValue(_:axis:) + 16
8 Charts 0x0000000106b88c4c AxisBase.getFormattedLabel(_:) + 160 (AxisBase.swift:149)
9 Charts 0x0000000106b88aa8 implicit closure #2 in implicit closure #1 in AxisBase.getLongestLabel() + 8 (AxisBase.swift:138)
10 Charts 0x0000000106b88aa8 thunk for #escaping #callee_guaranteed (#unowned Int) -> (#owned String) + 8 (:0)
11 Charts 0x0000000106b88aa8 specialized Optional.map(_:) + 8 (:0)
12 Charts 0x0000000106b88aa8 specialized LazyMapSequence.Iterator.next() + 8 (:0)
13 Charts 0x0000000106b88aa8 specialized protocol witness for IteratorProtocol.next() in conformance LazyMapSequence.Iterator + 8 (:0)
I am not sure if it is exactly the same bug, but it is also related to MonthNameFormater.
Given
Swift runtime failure: Index out of range + 0 (:0)
I suspect the crash happens at return symbols[index] - make sure index is in fact a valid index in symbols.
I'm getting a random crash on my live app on Float to Int conversion line.
I can't figure out why it's crashing and can't reproduce it as it's random crash on live app. Any suggestion on how to fix crash?
Crash log
Crashed: com.apple.main-thread
0 MyApp 0x100703778 closure #1 in MyViewController.getBalance(isRefreshed:) + 797 (MyViewController.swift:797)
1 MyApp 0x1005c7670 closure #1 in closure #1 in fetchtBalance(completed:) + 185 (Utils.swift:185)
2 MyApp 0x10051ab10 thunk for #escaping #callee_guaranteed () -> () + 4335790864 (<compiler-generated>:4335790864)
3 libdispatch.dylib 0x1ae908b7c _dispatch_call_block_and_release + 32
4 libdispatch.dylib 0x1ae909fd8 _dispatch_client_callout + 20
5 libdispatch.dylib 0x1ae915cc8 _dispatch_main_queue_callback_4CF + 968
6 CoreFoundation 0x1aebdee0c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
7 CoreFoundation 0x1aebd9b68 __CFRunLoopRun + 1980
8 CoreFoundation 0x1aebd9084 CFRunLoopRunSpecific + 480
9 GraphicsServices 0x1b8e27534 GSEventRunModal + 108
10 UIKitCore 0x1b2d49670 UIApplicationMain + 1940
11 MyApp 0x1004ec6b8 main + 20 (ClientMyProfileViewController.swift:20)
12 libdyld.dylib 0x1aea58e18 start + 4
Code
import UIKit
var balance: String!
var cost: String?
func getBalance () {
fetchBalance() { (result, error) in
guard let balanceFloatValue = Float(balance!) else {
print("Error")
return
}
guard let costFloat = Float(cost!) else {
print("Error")
return
}
let costPerSec = costFloat / 60
let talkTime = balanceFloatValue / costPerSec
let talkTimeInt = Int(talkTime) // Line No. 797 Crash here
// ....
}
}
The most likely cause for this error is the values themselves
let a:Float = 9999999999999999999999.9
let b = "0.000000000000000000001"
let c:Float = a/Float(b)!
let x = Int(c) // <- Crash here
0/0 will make you crash in: let c:Float = a/Float(b)! so thats not it, but anything else that can make talkTime outside of a Int will make you crash
This would also explain why you only encounter the error randomly since its only for values that make that division NaN or inf or something outside the int like bg2b said
I think you are force unwrapping the balance value. Try to unwrap the converted value like: „Float(balance)!“
I am getting this crash report from my users. I am not able to reproduce it so only few devices are having this issue.
Thread : Crashed: com.apple.main-thread
0 MY_PROJECT 0x00089fb8 static MY_PROJECT.GCHelper.rematch (MY_PROJECT.GCHelper.Type)(Swift.ImplicitlyUnwrappedOptional) -> () (GCHelper.swift:156)
1 libobjc.A.dylib 0x37624a37 objc_object::sidetable_retain() + 82
2 MY_PROJECT 0x000403f0 MY_PROJECT.GameScene.ButtonFunction (MY_PROJECT.GameScene)() -> () (GameScene.swift:727)
3 MY_PROJECT 0x00052ae0 function signature specialization of MY_PROJECT.GameScene.touchesEnded (MY_PROJECT.GameScene)(Swift.Set, withEvent : ObjectiveC.UIEvent) -> () (GameScene.swift:355)
4 MY_PROJECT 0x0003d7ac #objc MY_PROJECT.GameScene.touchesEnded (MY_PROJECT.GameScene)(Swift.Set, withEvent : ObjectiveC.UIEvent) -> () (GameScene.swift)
5 SpriteKit 0x2c668755 -[SKView touchesEnded:withEvent:] + 896
6 UIKit 0x2c7fc133 -[UIWindow _sendTouchesForEvent:] + 522
7 UIKit 0x2c7f5a41 -[UIWindow sendEvent:] + 540
8 UIKit 0x2c7cbc05 -[UIApplication sendEvent:] + 196
9 UIKit 0x2ca4231f _UIApplicationHandleEventFromQueueEvent + 14538
10 UIKit 0x2c7ca607 _UIApplicationHandleEventQueue + 1350
11 CoreFoundation 0x2915722f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
12 CoreFoundation 0x29156643 __CFRunLoopDoSources0 + 222
13 CoreFoundation 0x29154cc1 __CFRunLoopRun + 768
14 CoreFoundation 0x290a09a1 CFRunLoopRunSpecific + 476
15 CoreFoundation 0x290a07b3 CFRunLoopRunInMode + 106
16 GraphicsServices 0x3085f1a9 GSEventRunModal + 136
17 UIKit 0x2c82b695 UIApplicationMain + 1440
18 MY_PROJECT 0x00086790 main (AppDelegate.swift:16)
19 libdyld.dylib 0x37bb2aaf start + 2
Below is my rematch function from GCHelper class.
class func rematch(match:GKTurnBasedMatch!){
GCHelper.sharedInstance.rematch(match)
}
func rematch(match:GKTurnBasedMatch!){
match.rematchWithCompletionHandler({ (mMatch:GKTurnBasedMatch!, error:NSError!) -> Void in
if(error != nil){
println("\(error.description)")
} else{
println("rematch")
for var i = 0; i < mMatch.participants.count; i++ {
let participants = mMatch.participants as NSArray
let part = participants.objectAtIndex(i) as! GKTurnBasedParticipant
println("part \(i) \(part.description)")
if let playerID = part.playerID {
if(part.playerID != GKLocalPlayer.localPlayer().playerID){
self.opponentName = part.player.displayName
}
} else{
self.opponentName = "Opponent"
}
// println("participant name is \(part.playerID.)")
}
println("participant name is \(self.opponentName)")
self.delegate?.enterRematch(match,opponentName: self.opponentName)
}
})
}
And this is how I call rematch in my GameScene class.
GCHelper.rematch(self.currentTurnBasedMatch)
I don't even know at which line exactly the crash is happening. Anyone have any ideas?
Getting the following stack trace from Crashlytics.
Code that is crashing is return string
extension UserVisit: DashboardItem {
public var dashboardItemAttributedTitle: NSAttributedString {
let string = NSMutableAttributedString(string: "\(withUser.publicName) (\(withUser.publicAddress.fullDescription))", attributes: [NSFontAttributeName: UIFont.regularLight()])
string.addAttribute(NSFontAttributeName, value: UIFont.regularBold(), range: NSMakeRange(0 , count(withUser.publicName)))
return string /* Crash points to this line of code */
}
}
The code points to the return statement. The only reason I can think of for this crash is string being nil, which is not possible because if it was nil it would have crashed on the line above when addAttribute was called. Getting lots of these crashes and the stacktrace says absolutely nothing about what's causing it
Thread : Crashed: com.apple.main-thread
0 Company 0x00000001001c05c0 function signature specialization <Arg[0] = Owned To Guaranteed> of Company.UserVisit.dashboardItemAttributedTitle.getter : ObjectiveC.NSAttributedString (DashboardItemExtensions.swift:122)
1 Company 0x00000001001be674 #objc Company.UserVisit.dashboardItemAttributedTitle.getter : ObjectiveC.NSAttributedString (DashboardItemExtensions.swift)
2 Company 0x00000001001d3618 function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed> of Company.DashboardItemCell.configure (Company.DashboardItemCell)(Company.DashboardItem) -> () (DashboardItemCell.swift:93)
3 Company 0x00000001001d100c Company.DashboardItemCell.configure (Company.DashboardItemCell)(Company.DashboardItem) -> () (DashboardItemCell.swift)
4 Company 0x0000000100163cb4 function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed, Arg[2] = Owned To Guaranteed> of Company.DashboardViewController.collectionView (Company.DashboardViewController)(ObjectiveC.UICollectionView, cellForItemAtIndexPath : ObjectiveC.NSIndexPath) -> ObjectiveC.UICollectionViewCell (DashboardViewController.swift:567)
5 Company 0x000000010015f3b8 #objc Company.DashboardViewController.collectionView (Company.DashboardViewController)(ObjectiveC.UICollectionView, cellForItemAtIndexPath : ObjectiveC.NSIndexPath) -> ObjectiveC.UICollectionViewCell (DashboardViewController.swift)
6 UIKit 0x0000000187650710 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 284
7 UIKit 0x0000000187c7a850 __51-[UICollectionView _viewAnimationsForCurrentUpdate]_block_invoke1381 + 480
8 UIKit 0x00000001877c5164 -[UICollectionView _viewAnimationsForCurrentUpdate] + 2892
9 UIKit 0x0000000187c7b694 -[UICollectionView _updateWithItems:tentativelyForReordering:] + 1948
10 UIKit 0x0000000187c79c30 -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:] + 10120
11 UIKit 0x0000000187c7c988 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:] + 352
12 Company 0x000000010016c214 Company.DashboardViewController.((fetchAndPopulateDashboard in _59C7F3AF672DD71404DED200B8F15814) (Company.DashboardViewController) -> () -> ()).(closure #1) (DashboardViewController.swift:370)
13 Company 0x00000001000e1728 Company.BaseNetworkManager.(fetchObject (Company.BaseNetworkManager) -> <A>(A.Type, path : Swift.String, method : Company.Method, parameters : Swift.Optional<Swift.Dictionary<ObjectiveC.NSObject, Swift.AnyObject>>, errorHandler : Company.NetworkErrorHandler, completion : (Company.SingleNetworkResponse<A>) -> ()) -> Company.RequestMirror).(closure #1).(closure #1).(closure #1) (BaseNetworkManager.swift:219)
14 libdispatch.dylib 0x0000000194e6d994 _dispatch_call_block_and_release + 24
15 libdispatch.dylib 0x0000000194e6d954 _dispatch_client_callout + 16
16 libdispatch.dylib 0x0000000194e7220c _dispatch_main_queue_callback_4CF + 1608
17 CoreFoundation 0x0000000182b2b7f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
18 CoreFoundation 0x0000000182b298a0 __CFRunLoopRun + 1492
19 CoreFoundation 0x0000000182a552d4 CFRunLoopRunSpecific + 396
20 GraphicsServices 0x000000018c4b36fc GSEventRunModal + 168
21 UIKit 0x0000000187652f40 UIApplicationMain + 1488
22 Company 0x000000010003ac1c main (main.m:13)
23 libdyld.dylib 0x0000000194e9aa08 start + 4
The range for an attributed string must be in UTF-16 units.
I have an activity controller, which sometimes crashes and I dont understand why. This is my code:
func screenShotMethod() {
//Create the UIImage
let image = view?.snapshot
//Save it to the camera roll
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
self.socialShare(sharingText: "text", sharingImage: image, sharingURL:NSURL(string: "itms-apps://itunes.apple.com/app/bars/XXXXXXXX"))
}
func socialShare(#sharingText: String?, sharingImage: UIImage?, sharingURL: NSURL?) {
var sharingItems = [AnyObject]()
if let text = sharingText {
sharingItems.append(text)
}
if let image = sharingImage {
sharingItems.append(image)
}
if let url = sharingURL {
sharingItems.append(url)
}
let activityViewController = UIActivityViewController(activityItems: sharingItems, applicationActivities: nil)
activityViewController.excludedActivityTypes = [UIActivityTypeCopyToPasteboard,UIActivityTypeAirDrop,UIActivityTypeAddToReadingList,UIActivityTypeAssignToContact,UIActivityTypePostToTencentWeibo,UIActivityTypePostToVimeo,UIActivityTypePrint,UIActivityTypeSaveToCameraRoll,UIActivityTypePostToWeibo]
var currentViewController:UIViewController=UIApplication.sharedApplication().keyWindow!.rootViewController!
currentViewController.presentViewController(activityViewController, animated: true, completion: nil)
shareButton.alpha = 1.0
}
and here is my UIView snapshot extension:
extension UIView {
var snapshot: UIImage {
UIGraphicsBeginImageContextWithOptions(bounds.size, false, UIScreen.mainScreen().scale)
drawViewHierarchyInRect(bounds, afterScreenUpdates: true)
let result = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return result
}
}
and here are the errors I am getting:
Thread : Fatal Exception: NSGenericException
0 CoreFoundation 0x25a14fef __exceptionPreprocess
1 libobjc.A.dylib 0x33e00c8b objc_exception_throw
2 UIKit 0x2970ae63 -[UIPopoverPresentationController presentationTransitionWillBegin]
3 UIKit 0x2934209d __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke
4 UIKit 0x29340a17 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke
5 UIKit 0x290e4a91 _applyBlockToCFArrayCopiedToStack
6 UIKit 0x2905f38f _afterCACommitHandler
7 CoreFoundation 0x259dafed __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
8 CoreFoundation 0x259d86ab __CFRunLoopDoObservers
9 CoreFoundation 0x259d8ab3 __CFRunLoopRun
10 CoreFoundation 0x25925201 CFRunLoopRunSpecific
11 CoreFoundation 0x25925013 CFRunLoopRunInMode
12 GraphicsServices 0x2d101201 GSEventRunModal
13 UIKit 0x290c9a59 UIApplicationMain
14 A Void 0x000ba600 main (AppDelegate.swift:19)
15 libdyld.dylib 0x3438caaf start
and
Thread : Crashed: com.apple.main-thread
0 A Void 0x0013aa90 function signature specialization <Arg[0] = Owned To Guaranteed and Exploded, Arg[1] = Owned To Guaranteed, Arg[2] = Owned To Guaranteed> of A_Void.GameScene.touchesMoved (A_Void.GameScene)(Swift.Set<ObjectiveC.NSObject>, withEvent : ObjectiveC.UIEvent) -> () (GameScene.swift:2036)
1 A Void 0x0013a950 function signature specialization <Arg[0] = Owned To Guaranteed and Exploded, Arg[1] = Owned To Guaranteed, Arg[2] = Owned To Guaranteed> of A_Void.GameScene.touchesMoved (A_Void.GameScene)(Swift.Set<ObjectiveC.NSObject>, withEvent : ObjectiveC.UIEvent) -> () (GameScene.swift:2026)
2 A Void 0x0010b2bc #objc A_Void.GameScene.touchesMoved (A_Void.GameScene)(Swift.Set<ObjectiveC.NSObject>, withEvent : ObjectiveC.UIEvent) -> () (GameScene.swift)
3 SpriteKit 0x28f0a8af -[SKView touchesMoved:withEvent:] + 710
4 UIKit 0x2909a46b -[UIWindow _sendTouchesForEvent:] + 350
5 UIKit 0x29093df1 -[UIWindow sendEvent:] + 544
6 UIKit 0x29069fe5 -[UIApplication sendEvent:] + 196
7 UIKit 0x292e08fb _UIApplicationHandleEventFromQueueEvent + 14414
8 UIKit 0x290689f9 _UIApplicationHandleEventQueue + 1352
9 CoreFoundation 0x259dafaf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
10 CoreFoundation 0x259da3bf __CFRunLoopDoSources0 + 218
11 CoreFoundation 0x259d8a25 __CFRunLoopRun + 772
12 CoreFoundation 0x25925201 CFRunLoopRunSpecific + 476
13 CoreFoundation 0x25925013 CFRunLoopRunInMode + 106
14 GraphicsServices 0x2d101201 GSEventRunModal + 136
15 UIKit 0x290c9a59 UIApplicationMain + 1440
16 A Void 0x0014d600 main (AppDelegate.swift:19)
17 libdyld.dylib 0x3438caaf start + 2
The app is a game made with sprite kit, so I am calling this game method inside SKScene. Also, the game game view controller is the one controlling game scene and it is embed navigation view controller, in which I present gamecenter. Anyone nows how to fix this?