GameCenter Leaderboard in SpriteKit causing error - ios

I finished my game in Sprite Kit and am now trying to store the highscore in GameCenter's Leaderboards. I followed some tutorials that worked great for none-spritekit-projects. Steps to my error:
I debug my app without any errors, some warnings but they do no harm.
App runs great, and my starting SKActions work flawless.
I log in to GameCenter succesfully.
When I touch the screen it freezes and gives me a "Missed Method" log error and "Thread 1:EXC_BAD_ACCESS (code=1, address=0x80000012)". Whenever I delete the line of code causing the BAD_ACESS error it pops up some other place in my code.
My Log:
2014-04-21 19:51:26.893 Sharky[3417:60b] Missed Method
2014-04-21 19:51:27.683 Sharky[3417:60b] -[NSMethodSignature copyWithZone:]: unrecognized selector sent to instance 0xacbdc20
2014-04-21 19:51:27.685 Sharky[3417:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSMethodSignature copyWithZone:]: unrecognized selector sent to instance 0xacbdc20'
*** First throw call stack:
(
0 CoreFoundation 0x0009c1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x019978e5 objc_exception_throw + 44
2 CoreFoundation 0x00139243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0008c50b ___forwarding___ + 1019
4 CoreFoundation 0x0008c0ee _CF_forwarding_prep_0 + 14
5 libobjc.A.dylib 0x019a9bcd -[NSObject copy] + 41
6 SpriteKit 0x01481f4c -[SKNode runAction:] + 55
7 Sharky 0x0000595c -[MyScene touchesBegan:withEvent:] + 476
8 SpriteKit 0x014702bf -[SKView touchesBegan:withEvent:] + 824
9 UIKit 0x00576c0b -[UIWindow _sendTouchesForEvent:] + 386
10 UIKit 0x005779d1 -[UIWindow sendEvent:] + 1117
11 UIKit 0x005495f2 -[UIApplication sendEvent:] + 242
12 UIKit 0x00533353 _UIApplicationHandleEventQueue + 11455
13 CoreFoundation 0x0002577f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
14 CoreFoundation 0x0002510b __CFRunLoopDoSources0 + 235
15 CoreFoundation 0x000421ae __CFRunLoopRun + 910
16 CoreFoundation 0x000419d3 CFRunLoopRunSpecific + 467
17 CoreFoundation 0x000417eb CFRunLoopRunInMode + 123
18 GraphicsServices 0x03a7f5ee GSEventRunModal + 192
19 GraphicsServices 0x03a7f42b GSEventRun + 104
20 UIKit 0x00535f9b UIApplicationMain + 1225
21 Sharky 0x0000a472 main + 130
22 libdyld.dylib 0x023e4701 start + 1
23 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Does anyone have any clue whats going on? Or does someone have a step-by-step tutorial on how to integrate GameCenter Leaderboards into a sprite kit project?

Related

Bug detection terminal in Swift cites variable as issue - variable doesn't exist

The first view controller of my project crashed when segue'd to from another view controller - but not when it loads. I get this error message:
2016-01-05 20:06:33.836 collaboration[48812:1788623] -[collaboration.createAccountViewController loginExisting:]: unrecognized selector sent to instance 0x796cc950
2016-01-05 20:06:33.849 collaboration[48812:1788623] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[collaboration.createAccountViewController loginExisting:]: unrecognized selector sent to instance 0x796cc950'
*** First throw call stack:
(
0 CoreFoundation 0x00396a14 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x022c5e02 objc_exception_throw + 50
2 CoreFoundation 0x0039fd63 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x002dd6bd ___forwarding___ + 1037
4 CoreFoundation 0x002dd28e _CF_forwarding_prep_0 + 14
5 libobjc.A.dylib 0x022da0b5 -[NSObject performSelector:withObject:withObject:] + 84
6 UIKit 0x00df7b79 -[UIApplication sendAction:to:from:forEvent:] + 118
7 UIKit 0x00df7af8 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
8 UIKit 0x00f978f8 -[UIControl sendAction:to:forEvent:] + 79
9 UIKit 0x00f97c78 -[UIControl _sendActionsForEvents:withEvent:] + 408
10 UIKit 0x00f96c7e -[UIControl touchesEnded:withEvent:] + 714
11 UIKit 0x00e74182 -[UIWindow _sendTouchesForEvent:] + 1095
12 UIKit 0x00e75220 -[UIWindow sendEvent:] + 1159
13 UIKit 0x00e19f93 -[UIApplication sendEvent:] + 266
14 UIKit 0x00def668 _UIApplicationHandleEventQueue + 7802
15 CoreFoundation 0x002b06ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
16 CoreFoundation 0x002a638b __CFRunLoopDoSources0 + 523
17 CoreFoundation 0x002a57a8 __CFRunLoopRun + 1032
18 CoreFoundation 0x002a50e6 CFRunLoopRunSpecific + 470
19 CoreFoundation 0x002a4efb CFRunLoopRunInMode + 123
20 GraphicsServices 0x07075664 GSEventRunModal + 192
21 GraphicsServices 0x070754a1 GSEventRun + 104
22 UIKit 0x00df5bfa UIApplicationMain + 160
23 collaboration 0x00085a3c main + 140
24 libdyld.dylib 0x039bca21 start + 1
25 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
As you can see, it cites the variable 'loginExisting' as the issue, however loginExisting is not a variable on in any of my scripts (it was before but has since been removes). How can I 'refresh' XCode so that it forgets about the absent variable? I have tried restarting my machine and cleaning XCode but have had not success.
Thank you for your help.
Go to your storyboard that's crashing and right click the yellow icon at the top of the ViewController.
After right clicking, look towards the bottom where it says "Received actions" and delete all of the actions pertaining to the loginExisting method.
This is one of many possible culprits, but this tends to be the most common.
EDIT: It's also possible that you have a property (IBOutlet) connected to the storyboard that no longer exists which will throw an error.

App Crashes (Sometimes) when Home Button is Pressed

I am really confused as to why this is happening.
Since this happened randomly
Here is the stacktrace, I have not been able to figure it out.
Please help
Thanks
2015-03-30 15:12:50.817 MarcoApp[1857:23629] -[NSIBPrototypingLayoutConstraint finishedLoading]: unrecognized selector sent to instance 0x7f929ccc8cf0
2015-03-30 15:12:50.908 MarcoApp[1857:23629] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSIBPrototypingLayoutConstraint finishedLoading]: unrecognized selector sent to instance 0x7f929ccc8cf0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010aa74a75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010a333bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010aa7bd1d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010a9d39dc ___forwarding___ + 988
4 CoreFoundation 0x000000010a9d3578 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x000000010aa447fc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
6 CoreFoundation 0x000000010a944204 _CFXNotificationPost + 2484
7 Foundation 0x0000000109e8ddf8 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
8 UIKit 0x000000010b73baa7 -[UIApplication _handleApplicationDectivationWithScene:shouldForceExit:transitionContext:completion:] + 1054
9 UIKit 0x000000010b748833 __88-[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:]_block_invoke + 87
10 UIKit 0x000000010b7487cd -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:] + 349
11 UIKit 0x000000010b73345a -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 486
12 FrontBoardServices 0x00000001115ae243 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
13 CoreFoundation 0x000000010a9a9c7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
14 CoreFoundation 0x000000010a99f9c5 __CFRunLoopDoBlocks + 341
15 CoreFoundation 0x000000010a99f785 __CFRunLoopRun + 2389
16 CoreFoundation 0x000000010a99ebc6 CFRunLoopRunSpecific + 470
17 GraphicsServices 0x000000010e89ca58 GSEventRunModal + 161
18 UIKit 0x000000010b735580 UIApplicationMain + 1282
19 MarcoApp 0x0000000109184afe top_level_code + 78
20 MarcoApp 0x0000000109184bda main + 42
21 libdyld.dylib 0x000000010ee2b145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
hard to tell without seeing your code but "unrecognized selector sent to instance" implies you have a method the requires a selector (name of a function) as a parameter and that methods got an invalid selector (the name of the function is wrong).
not sure but ther is any method in
- (void)applicationWillResignActive:(UIApplication *)application
which does not have selector thats why you app crash

NSURL URLWithString gives error: unrecognized selector sent to instance

In my new app I have to external links. One in the view that only is shown the very first time the app is started and one in tab3. The link in tab3 is working, but the link in the initial screen is giving a crash, while exactly the same code is used.
Code for ViewController.h
- (IBAction)findAllyId;
Code for ViewController.m
- (IBAction)findAllyId {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://youtu.be/H_AguOLEHW8"]];
}
Error log after pressing the Button that is linked to this findAllyId
2015-03-13 19:03:30.666 Friend codes for Kingdom Age[89581:40810062] -[ViewController findAllyId]: unrecognized selector sent to instance 0x7facaa694530
2015-03-13 19:03:30.674 Friend codes for Kingdom Age[89581:40810062] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController findAllyId]: unrecognized selector sent to instance 0x7facaa694530'
*** First throw call stack:
(
0 CoreFoundation 0x000000010e141a75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010dddabb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010e148d1d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010e0a09dc ___forwarding___ + 988
4 CoreFoundation 0x000000010e0a0578 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010c430a22 -[UIApplication sendAction:to:from:forEvent:] + 75
6 UIKit 0x000000010c537e50 -[UIControl _sendActionsForEvents:withEvent:] + 467
7 UIKit 0x000000010c53721f -[UIControl touchesEnded:withEvent:] + 522
8 UIKit 0x000000010c476b68 -[UIWindow _sendTouchesForEvent:] + 735
9 UIKit 0x000000010c477493 -[UIWindow sendEvent:] + 683
10 UIKit 0x000000010c443fb1 -[UIApplication sendEvent:] + 246
11 UIKit 0x000000010c451227 _UIApplicationHandleEventFromQueueEvent + 17700
12 UIKit 0x000000010c42c23c _UIApplicationHandleEventQueue + 2066
13 CoreFoundation 0x000000010e076c91 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x000000010e06cb5d __CFRunLoopDoSources0 + 269
15 CoreFoundation 0x000000010e06c194 __CFRunLoopRun + 868
16 CoreFoundation 0x000000010e06bbc6 CFRunLoopRunSpecific + 470
17 GraphicsServices 0x000000010fc5aa58 GSEventRunModal + 161
18 UIKit 0x000000010c42f580 UIApplicationMain + 1282
19 Friend codes for Kingdom Age 0x000000010b9f9d83 main + 115
20 libdyld.dylib 0x000000010e6af145 start + 1
21 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Again, exactly the same code (with a different URL) is working in another screen of the app, with a click on a button.

Terminating with uncaught exception of type NSException on iOS 7.1

When I run my app on a iOS 8+ or later device, it runs perfectly with no errors but when I run it on a iOS 7.1 device the app crashes with this message:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SKLabelNode labelNodeWithText:]: unrecognized selector sent to class 0xedc5fc'
*** First throw call stack:
(
0 CoreFoundation 0x0098a1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x004d58e5 objc_exception_throw + 44
2 CoreFoundation 0x00a270e3 +[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0097a50b ___forwarding___ + 1019
4 CoreFoundation 0x0097a0ee _CF_forwarding_prep_0 + 14
5 Origami Game 0x0002161f -[GBAGameScene initWithSize:] + 495
6 Origami Game 0x000281b4 -[GBAMenuScene touchesBegan:withEvent:] + 500
7 SpriteKit 0x00e102bf -[SKView touchesBegan:withEvent:] + 824
8 UIKit 0x00f64c0b -[UIWindow _sendTouchesForEvent:] + 386
9 UIKit 0x00f659d1 -[UIWindow sendEvent:] + 1117
10 UIKit 0x00f375f2 -[UIApplication sendEvent:] + 242
11 UIKit 0x00f21353 _UIApplicationHandleEventQueue + 11455
12 CoreFoundation 0x0091377f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
13 CoreFoundation 0x0091310b __CFRunLoopDoSources0 + 235
14 CoreFoundation 0x009301ae __CFRunLoopRun + 910
15 CoreFoundation 0x0092f9d3 CFRunLoopRunSpecific + 467
16 CoreFoundation 0x0092f7eb CFRunLoopRunInMode + 123
17 GraphicsServices 0x025245ee GSEventRunModal + 192
18 GraphicsServices 0x0252442b GSEventRun + 104
19 UIKit 0x00f23f9b UIApplicationMain + 1225
20 Origami Game 0x00026d5d main + 141
21 libdyld.dylib 0x02a756d9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I don't know what's happening, my app uses the Sprite Kit framework and I'm not using the storyboards, just code.
The init method initWithText: which is called by the class method [SKLabelNode labelNodeWithText:] was only added in iOS 8 so you cannot call this method in iOS 7. As a workaround use:
SKLabelNode *lbl=[SKLabelNode labelNodeWithFontNamed: "Arial"];
lbl.text="hello world";
To find which methods are available on which OS look at the docs.
(sorry if my obj-c isn't right or the method has a different name)

Signal 1 SIGARBT Crash (PlaySound?)

I started getting this error when I tried to make a button play a sound. I'm not getting a code errors (Red or Yellow markers) but my app crashes when I click the button.
Here's what the console outputs:
2014-05-12 20:24:59.866 ReAct[4511:60b] -[ViewController PlayAudioBUtton:]: unrecognized selector sent to instance 0x9059280
2014-05-12 20:24:59.875 ReAct[4511:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController PlayAudioBUtton:]: unrecognized selector sent to instance 0x9059280'
*** First throw call stack:
(
0 CoreFoundation 0x01c6c1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x019eb8e5 objc_exception_throw + 44
2 CoreFoundation 0x01d09243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x01c5c50b ___forwarding___ + 1019
4 CoreFoundation 0x01c5c0ee _CF_forwarding_prep_0 + 14
5 libobjc.A.dylib 0x019fd880 -[NSObject performSelector:withObject:withObject:] + 77
6 UIKit 0x006ad3b9 -[UIApplication sendAction:to:from:forEvent:] + 108
7 UIKit 0x006ad345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
8 UIKit 0x007aebd1 -[UIControl sendAction:to:forEvent:] + 66
9 UIKit 0x007aefc6 -[UIControl _sendActionsForEvents:withEvent:] + 577
10 UIKit 0x007ae243 -[UIControl touchesEnded:withEvent:] + 641
11 UIKit 0x006ecddd -[UIWindow _sendTouchesForEvent:] + 852
12 UIKit 0x006ed9d1 -[UIWindow sendEvent:] + 1117
13 UIKit 0x006bf5f2 -[UIApplication sendEvent:] + 242
14 UIKit 0x006a9353 _UIApplicationHandleEventQueue + 11455
15 CoreFoundation 0x01bf577f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
16 CoreFoundation 0x01bf510b __CFRunLoopDoSources0 + 235
17 CoreFoundation 0x01c121ae __CFRunLoopRun + 910
18 CoreFoundation 0x01c119d3 CFRunLoopRunSpecific + 467
19 CoreFoundation 0x01c117eb CFRunLoopRunInMode + 123
20 GraphicsServices 0x031ac5ee GSEventRunModal + 192
21 GraphicsServices 0x031ac42b GSEventRun + 104
22 UIKit 0x006abf9b UIApplicationMain + 1225
23 ReAct 0x000020cd main + 141
24 libdyld.dylib 0x02996701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I think it's due to the first description:
"Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController PlayAudioBUtton:]: unrecognized selector sent to instance 0x9059280'"
But I'm unsure of what this means because I am new to Xcode and iOS coding alike.
Any help is greatly appreciated.

Resources