exc_bad_access only iOS Version < 9 - textfield deallocated ( - ios

My app doesn't work for Versions older than iOS 9.x
The APP throws an EXC_BAD_ACCESS exception at a textField. The textField is in a tableView.
I enabled Zombie Objects: "[_UILabelLayer opacity]: message sent to deallocated instance 0x81018770"
It doesn't appear at the beginning. It only crashs when I click on the tableView cells or when my 30 seconds timer refreshs the UI. (I disabled the timer, but there were no changes)
I tried dispatch_async(dispatch_get_main_queue()) and semaphores. I got no positive effects.
I check, whether the objects is nil, but it isn't:
if self.textField != nil {
if let textFieldNotNil = self.textField {
// textField.removeFromSuperview()
print("The Textfield \(textFieldNotNil.text)")
print("The Textfield \(textFieldNotNil)")
dispatch_async(dispatch_get_main_queue()) {
textFieldNotNil.text = strValue
}
}
}
When I use textField.removeFromSuperview() the app works again, but then there is no value inside the textfield. (That is clear, I removed it from the superview -.-)
Can I check, if my textfield is allocated? I can't find anything.
Have someone any other ideas?
EDIT
Sending a message to a nil would not cause your app to crash, I think.
I think this, too. My textfield isn't nil, too. But it crashs, this is the strange thing.
Do you have a StackTrace?
If u mean with StackTrace a do { try ... } catch {}-construct. No, I haven't. I searched for an example to surround a textfield.text = ".." with do/try/catch, but I can't find.
When does it crash? When you access textFieldNotNil.text?
This is the strange thing. It crashs in the line: textFieldNotNil.text = strValue
The error is that textFieldNotNil is deallocated. textFieldNotNil is called, when the user clicks on a tableViewCell or every 30 seconds.
Does this crash happen when you replace textFieldNotNil.text = strValue with [textFieldNotNil setText:strValue]?
Is it objectiv C? The compiler is bitching "Expected "," separator
You could also try textFieldNotNil.stringValue = strValue
I can't. My textFieldNotNil hasn't an attribute like stringValue. What's that?
Is self.textField declared weak?
Yes, it is. #IBOutlet weak var textField: UITextField?
Are you on a background thread when you call dispatch_async?
I don't know... I don't understand the stacktrace output so much.
* thread #1: tid = 0x38475f, 0x058f8e86 libsystem_kernel.dylib`__kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGKILL
frame #0: 0x058f8e86 libsystem_kernel.dylib`__kill + 10
frame #1: 0x058f5db9 libsystem_kernel.dylib`kill$UNIX2003 + 32
frame #2: 0x01f4829d CoreFoundation`___forwarding___ + 1069
frame #3: 0x01f47e4e CoreFoundation`__forwarding_prep_0___ + 14
frame #4: 0x034904e8 UIKit`-[UIView(Rendering) alpha] + 42
frame #5: 0x1287e70a UIKit`-[UILabelAccessibility isAccessibilityElement] + 90
frame #6: 0x12aba330 MessageUIFramework`-[MessageUILabelAccessibility isAccessibilityElement] + 104
frame #7: 0x128942c9 UIKit`-[UITextFieldAccessibility _accessibilityCountAccessibleChildren:] + 211
frame #8: 0x1289449c UIKit`__42-[UITextFieldAccessibility _updateButtons]_block_invoke + 46
frame #9: 0x055bf5ea libdispatch.dylib`_dispatch_call_block_and_release + 15
frame #10: 0x055e1bef libdispatch.dylib`_dispatch_client_callout + 14
frame #11: 0x055c52ef libdispatch.dylib`_dispatch_after_timer_callback + 156
frame #12: 0x055e1bef libdispatch.dylib`_dispatch_client_callout + 14
frame #13: 0x055d713a libdispatch.dylib`_dispatch_source_latch_and_call + 1063
frame #14: 0x055ce325 libdispatch.dylib`_dispatch_source_invoke + 375
frame #15: 0x055c74ee libdispatch.dylib`_dispatch_main_queue_callback_4CF + 532
frame #16: 0x01f528ee CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
frame #17: 0x01f105f0 CoreFoundation`__CFRunLoopRun + 2256
frame #18: 0x01f0fa5b CoreFoundation`CFRunLoopRunSpecific + 443
frame #19: 0x01f0f88b CoreFoundation`CFRunLoopRunInMode + 123
frame #20: 0x061a52c9 GraphicsServices`GSEventRunModal + 192
frame #21: 0x061a5106 GraphicsServices`GSEventRun + 104
frame #22: 0x0340a0b6 UIKit`UIApplicationMain + 1526
* frame #23: 0x0031584c CocoSoftIOSBaseApp`main + 140 at AppDelegate.swift:16
frame #24: 0x0560cac9 libdyld.dylib`start + 1
... a lot of more Threads

Related

Share data between two view controllers via userDeafults

I'm creating UISwitch that controls two view controllers, and I need to share data of UISwitch condition between them. I tried to use User Defaults but got SIGABRT error. What do I need to fix to get it working?
// Its view with UISwitch
#IBAction func SwitchThemeColor(_ sender: UISwitch) {
if SwitchTheme.isOn || traitCollection.userInterfaceStyle == .dark {
view.backgroundColor = UIColor.black
UserDefaults.standard.set(true, forKey: "switchState")
UserDefaults.standard.synchronize()
}
// And that is the view where I want to transfer UISwitch condition
if UserDefaults.standard.bool(forKey: "switchState") == true {
view.backgroundColor = UIColor.black
}
expected: that data transfers and switch controls background of two views
actual: SIGABRT error and it did not work
also I write bt in output and get this:
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00007fff513782c6 libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fff5141fbf1 libsystem_pthread.dylib`pthread_kill + 284
frame #2: 0x00007fff51308a5c libsystem_c.dylib`abort + 120
frame #3: 0x00007fff4f22e7f8 libc++abi.dylib`abort_message + 231
frame #4: 0x00007fff4f22e9c7 libc++abi.dylib`demangling_terminate_handler() + 262
frame #5: 0x00007fff503b5d7c libobjc.A.dylib`_objc_terminate() + 96
frame #6: 0x00007fff4f23be97 libc++abi.dylib`std::__terminate(void (*)()) + 8
frame #7: 0x00007fff4f23be39 libc++abi.dylib`std::terminate() + 41
frame #8: 0x00007fff503b5d1c libobjc.A.dylib`objc_terminate + 9
frame #9: 0x000000010ff1cd78 libdispatch.dylib`_dispatch_client_callout + 28
frame #10: 0x000000010ff1fcd5 libdispatch.dylib`_dispatch_block_invoke_direct + 300
frame #11: 0x00007fff3633108a FrontBoardServices`__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
frame #12: 0x00007fff36330d78 FrontBoardServices`-[FBSSerialQueue _queue_performNextIfPossible] + 441
frame #13: 0x00007fff36331287 FrontBoardServices`-[FBSSerialQueue _performNextFromRunLoopSource] + 22
frame #14: 0x00007fff23afbac1 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
frame #15: 0x00007fff23afb9ec CoreFoundation`__CFRunLoopDoSource0 + 76
frame #16: 0x00007fff23afb21c CoreFoundation`__CFRunLoopDoSources0 + 268
frame #17: 0x00007fff23af5ecf CoreFoundation`__CFRunLoopRun + 1263
frame #18: 0x00007fff23af56b6 CoreFoundation`CFRunLoopRunSpecific + 438
frame #19: 0x00007fff3815cbb0 GraphicsServices`GSEventRunModal + 65
frame #20: 0x00007fff47162a67 UIKitCore`UIApplicationMain + 1621
* frame #21: 0x000000010fa7bdab TabbedAppTest`main at AppDelegate.swift:12:7
frame #22: 0x00007fff5123bcf5 libdyld.dylib`start + 1
frame #23: 0x00007fff5123bcf5 libdyld.dylib`start + 1
Problem is somewhere else - this code should works.
You mention in comment, that you get error message: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<TabbedAppTest.SecondViewController 0x7f8d84516c60> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key BarItem.
It looks like you have in storyboard/xib file some old outlet for key BarItem in you SecondViewController class. Probably you removed outlet from code programmatically, but outlet in storyboard/xib stays.

iOS app crashes on an iPhone even though it runs on simulator

Even though it worked nicely on the simulator, my multiview app crashes on an iPhone 5 C (by ’nicely’, I mean no memory leaks, smooth animation as buttons move into place, etc.). The app is written in Objective C, The simulator runs under Xcode 8.3.3. The phone runs iOS 10.3.3.
The problem happens when I press a sync button that switches from SyncViewController to PlayViewController i.e. from VC3 to VC4 after switching successfully from VC1 to VC2 to VC3. Each ViewController has a delegate method that responds to buttons pressed from within the previous ViewController.
The crash happens consistently in the following method that displays three things in PlayView : a horizontally scrollable graphic score, a button with a time display that is overwritten every second and a stop button.
- (UIView *)showScoreClockAndExit:(CGRect)panel highlight:(int)currentState seconds:(NSUInteger)clockCount {
if (!self.seconds)
{
[self.seconds removeFromSuperview];
self.seconds = [[ClockButton alloc] loadClockButton:(NSUInteger)clockCount];
[self addSubview:_seconds];
}
ClockButton *seconds = [[ClockButton alloc] loadClockButton:(NSUInteger)clockCount];
[self addSubview:seconds];
EscButton *escape = [[EscButton alloc] loadEscButton:(NSString *)#"stop"];
[self addSubview:escape];
GraphicScore *score = [[GraphicScore alloc] createGraphicScore:(CGRect)panel highlight:(int)currentState];
[self addSubview:score];
return self;
}
What is weird is that the last UIView previously loaded by SyncViewController remains frozen on the device itself even though the PlayViewController has already begun taking over from SyncViewController, i.e PlayView is loaded, a UITimer is set up and the state of play for the selected player is enabled, as the debug log (below) clearly shows
2017-07-24 15:25:24.950097+1000 SatGam2[3052:1712261] PlayView loaded (selectedFamily:1 selectedPlayerID:1)
2017-07-24 15:25:24.950923+1000 SatGam2[3052:1712261] TIME: 00:00
2017-07-24 15:25:24.951905+1000 SatGam2[3052:1712261] ENABLED (player 1: state 0)
(lldb)
Following a helpful lead I found here, I typed : bt and pressed: Enter to get the following log
SatGam2 was compiled with optimization - stepping may behave oddly; variables may not be available.
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xe15d25d2)
frame #0: 0x1b300694 libobjc.A.dylib`objc_retain + 4
frame #1: 0x21291d0a UIKit`-[UIView(Hierarchy) addSubview:] + 18
* frame #2: 0x000c2696 SatGam2`-[PlayView showScoreClockAndExit:highlight:seconds:](self=0x15e9ed70, _cmd=<unavailable>, panel=<unavailable>, currentState=<unavailable>, clockCount=<unavailable>) at PlayView.m:215 [opt]
frame #3: 0x000c246c SatGam2`-[PlayView initWithFrame:state:family:player:cue:seconds:](self=<unavailable>, _cmd=<unavailable>, frame=<unavailable>, currentState=<unavailable>, selectedFamily=<unavailable>, selectedPlayerID=<unavailable>, entryString=#"", clockCount=<unavailable>) at PlayView.m:149 [opt]
frame #4: 0x000cd0da SatGam2`-[PlayViewController nextState](self=0x168aae00, _cmd=<unavailable>) at PlayViewController.m:244 [opt]
frame #5: 0x000ccc40 SatGam2`-[PlayViewController viewDidLoad](self=0x168aae00, _cmd=<unavailable>) at PlayViewController.m:152 [opt]
frame #6: 0x2128b27e UIKit`-[UIViewController loadViewIfRequired] + 966
frame #7: 0x2128aea0 UIKit`-[UIViewController view] + 22
frame #8: 0x000c1266 SatGam2`-[MultiviewViewController displayView:](self=0x15d85710, _cmd=<unavailable>, intNewView=4) at MultiviewViewController.m:45 [opt]
frame #9: 0x000c2fb6 SatGam2`-[SyncViewController fromSyncButton:](self=<unavailable>, _cmd=<unavailable>, button=<unavailable>) at SyncViewController.m:65 [opt]
frame #10: 0x212bf784 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 76
frame #11: 0x212bf718 UIKit`-[UIControl sendAction:to:forEvent:] + 62
frame #12: 0x212a9d48 UIKit`-[UIControl _sendActionsForEvents:withEvent:] + 478
frame #13: 0x212bf054 UIKit`-[UIControl touchesEnded:withEvent:] + 604
frame #14: 0x212beb9e UIKit`-[UIWindow _sendTouchesForEvent:] + 2094
frame #15: 0x212b9ade UIKit`-[UIWindow sendEvent:] + 2798
frame #16: 0x2128b682 UIKit`-[UIApplication sendEvent:] + 308
frame #17: 0x21a1ede6 UIKit`__dispatchPreprocessedEventFromEventQueue + 2254
frame #18: 0x21a1978a UIKit`__handleEventQueue + 4186
frame #19: 0x21a19b6c UIKit`__handleHIDEventFetcherDrain + 144
frame #20: 0x1c01bfdc CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
frame #21: 0x1c01bb04 CoreFoundation`__CFRunLoopDoSources0 + 424
frame #22: 0x1c019f50 CoreFoundation`__CFRunLoopRun + 1160
frame #23: 0x1bf6d1ae CoreFoundation`CFRunLoopRunSpecific + 470
frame #24: 0x1bf6cfd0 CoreFoundation`CFRunLoopRunInMode + 104
frame #25: 0x1d717b40 GraphicsServices`GSEventRunModal + 80
frame #26: 0x212eee12 UIKit`UIApplicationMain + 150
frame #27: 0x1b75a4ea libdyld.dylib`start + 2
(lldb)
I cleared all apps previously tested on the phone. I also tried a version of the app backed up last month to eliminate any problems I may have introduced since I began working on deviceMotion. But the problem remains the same.
Has anyone seen something like this ? Where would I begin ? e.g. like where would I put a breakpoint ?
This checking is incorrect.
if (!self.seconds)
{
[self.seconds removeFromSuperview];
self.seconds = [[ClockButton alloc] loadClockButton:(NSUInteger)clockCount];
[self addSubview:_seconds];
}
!self.seconds could be used if it is a boolean. In this case it seems self.seconds is some sort of a view. So what you should do is:
if (self.seconds!=nil) {
[self.seconds removeFromSuperView];
self.seconds = [[ClockButton alloc] loadClockButton:(NSUInteger)clockCount];
[self addSubview:_seconds];
}

Crash with pdfTron Integration iOS

I am using pdfTron with iOS. I have successfully integrated PDFTron with my iOS application.
Now I am facing an issue where in if an already made annotation is selected and I try to go back from the view, the application is crashing with EXC_BAD_ACCESS error. I am able to see the previous screen while going back. After the previous screen appears, then the app gets crashed in main. This does not happen when I come back without the annotation being selected.
* thread #1: tid = 0x14c78, 0x0281b3f6 myProject`___lldb_unnamed_symbol40638$$myProject + 22, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x800000a0)
frame #0: 0x0281b3f6 myProject`___lldb_unnamed_symbol40638$$myProject + 22
frame #1: 0x0250ce31 myProject`___lldb_unnamed_symbol28291$$myProject + 49
frame #2: 0x01bf03f8 myProject`TRN_AnnotIsValid + 40
frame #3: 0x01afd0ba myProject`ObjCPP_PTAnnot_IsValid + 34
frame #4: 0x01a80e0a myProject`-[PTAnnot IsValid] + 32
frame #5: 0x0199d062 myProject`-[AnnotEditTool deselectAnnotation] + 66
frame #6: 0x0198e96b myProject`-[AnnotEditTool willMoveToSuperview:] + 91
frame #7: 0x066e21ce UIKit`__UIViewWillBeRemovedFromSuperview + 305
frame #8: 0x066e1ee3 UIKit`-[UIView(Hierarchy) removeFromSuperview] + 99
frame #9: 0x019a0c09 myProject`-[ToolManager dealloc] + 73
frame #10: 0x06ef413d UIKit`-[UIView(UIKitManual) release] + 142
frame #11: 0x01a7acae myProject`-[PTPDFViewCtrl dealloc] + 588
frame #12: 0x06ef413d UIKit`-[UIView(UIKitManual) release] + 142
frame #13: 0x08e0ca57 CoreFoundation`CFRelease + 727
frame #14: 0x08e2285e CoreFoundation`-[__NSArrayM dealloc] + 142
frame #15: 0x08966060 libobjc.A.dylib`objc_object::sidetable_release(bool) + 238
frame #16: 0x08965361 libobjc.A.dylib`objc_release + 65
frame #17: 0x0896652d libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 371
frame #18: 0x08e2d508 CoreFoundation`_CFAutoreleasePoolPop + 24
frame #19: 0x08e65cdc CoreFoundation`__CFRunLoopRun + 2364
frame #20: 0x08e650e6 CoreFoundation`CFRunLoopRunSpecific + 470
frame #21: 0x08e64efb CoreFoundation`CFRunLoopRunInMode + 123
frame #22: 0x0a49a664 GraphicsServices`GSEventRunModal + 192
frame #23: 0x0a49a4a1 GraphicsServices`GSEventRun + 104
frame #24: 0x0662bbfa UIKit`UIApplicationMain + 160
* frame #25: 0x0013c23c myProject`main(argc=1, argv=0xbffaa928) + 140 at main.m:16
frame #26: 0x09e6ca21 libdyld.dylib`start + 1
The first thing that Annot::IsValid does is check if the pointer is null or not. So if IsValid is crashing, then this means the underlying PDFDoc object has been destroyed, or the underlying pointer is not valid somehow.
First thing to check is if the PDFDoc object is alive or not. If it is destroyed then no objects associated with it should be used.
Or, you deleted the Annotation object earlier somehow, or its underlying pointer got changed. Object references should not be kept around in case they do get moved/deleted. If you want to retain annotations for long term, please see this post.

UITextView becomeFirstResponder crash with EXC bad access

I have a UIViewController with UITextView in the storyboard I assigned it with strong variable.The first time when I present the ViewController using story board segue there is no crash but when I dismiss the ViewController and again present the ViewController for the second time after [UITextView becomeFirstResponder] is called the app crashes and shows the following error
[UIViewController _responderWindow]: message sent to deallocated instance
I have assigned delegate to the ViewController in which the TextView is added and implemented all the delegate methods
I tried calling this method [UITextview becomeFirstResponder] after a delay
but no use it was still crashing
I tried profiling with zombie template the error is in UIKit
this is the response I am getting when the app crashed if enable zombies in the product scheme
[ReviewViewController _responderWindow]: message sent to deallocated instance 0x14ed3a2a0
this is the code I am using to present the viewcontroller which has the textview
[_promotionsViewControllerDelegate performSegueWithIdentifier:#"testing" sender:nil];
textview viewcontroller
- (void)viewDidLoad {
[super viewDidLoad];
_reviewTextView.delegate = self;
[_reviewTextView becomeFirstResponder];
}
this is the back trace error log when i run the application without zombies
* thread #1: tid = 0x758d4, 0x000000019271bbd0 libobjc.A.dylib`objc_msgSend + 16, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x174697260)
frame #0: 0x000000019271bbd0 libobjc.A.dylib`objc_msgSend + 16
frame #1: 0x000000018675f96c UIKit`-[UIView(Internal) _firstResponder] + 24
frame #2: 0x000000018675f940 UIKit`-[UIResponder isFirstResponder] + 32
frame #3: 0x0000000186e96ed8 UIKit`-[UITextView _keyboardDidShow:] + 32
frame #4: 0x0000000181f58ae4 CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
frame #5: 0x0000000181e97220 CoreFoundation`_CFXNotificationPost + 2060
frame #6: 0x0000000182d96cc0 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 72
frame #7: 0x0000000186e5f458 UIKit`-[UIInputWindowController postEndNotifications:withInfo:] + 580
frame #8: 0x0000000186e60c7c UIKit`__77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke595 + 396
frame #9: 0x000000018679c0a4 UIKit`-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 408
frame #10: 0x000000018679bc0c UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 188
frame #11: 0x000000018679bb14 UIKit`-[UIViewAnimationState animationDidStop:finished:] + 104
frame #12: 0x00000001860c0f64 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 296
frame #13: 0x00000001002b4df0 libdispatch.dylib`_dispatch_client_callout + 16
frame #14: 0x00000001002b975c libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1056
frame #15: 0x0000000181f69fa4 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
frame #16: 0x0000000181f6804c CoreFoundation`__CFRunLoopRun + 1492
frame #17: 0x0000000181e950a4 CoreFoundation`CFRunLoopRunSpecific + 396
frame #18: 0x000000018b0375a4 GraphicsServices`GSEventRunModal + 168
frame #19: 0x00000001867ca3c0 UIKit`UIApplicationMain + 1488
* frame #20: 0x00000001000c1030 WineDisciples`main(argc=1, argv=0x000000016fd83a58) + 116 at main.m:14
frame #21: 0x0000000192d76a08 libdyld.dylib`start + 4
I Kindly request you to help me on this thanks..
Did you check your Identifier in inspector window similar to given in code (i.e. "testing" )?
Also in your .h file had you given the . If not then add it.
Maybe is too late, but I had the same problem and the solution was to send remove from superview in the dealloc method of my vwc
deinit {
self.commentTextView.delegate = nil
self.commentTextView.removeFromSuperview()
}

iOS 6 EXC_BAD_ACCESS (code=2, address=0x15) When Presenting Game Center, But fine in iOS 7+

Trying to present my GKGameCenterViewController. It works fine in iOS 7, but when i try to.....
GKGameCenterViewController *gamecenterViewController = [[GKGameCenterViewController alloc]init];
gamecenterViewController.viewState = GKGameCenterViewControllerStateDefault;
gamecenterViewController.gameCenterDelegate = self;
[[CCDirector sharedDirector] presentModalViewController:gamecenterViewController animated:YES];
...in iOS 6, i get a iOS 6 EXC_BAD_ACCESS (code=2, address=0x15) error.
I've tried stepping in, but seems to step through ok until it gets to the funny looking code...
I've read many pre-existing and similar faults, but most seem to report additional output from the debugger, but I'm simply not getting anything more than the above quoted error...
This is my bt output after the crash took place..
(lldb) bt
*thread #1: tid = 0x697d9, 0x024a709b libobjc.A.dylib`objc_msgSend + 15, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=2, address=0x47)
frame #0: 0x024a709b libobjc.A.dylib`objc_msgSend + 15
frame #1: 0x0222fb4b GameKit`__55-[GKGameCenterViewController _setupChildViewController]_block_invoke_083 + 42
frame #2: 0x0222b896 GameKit`__61-[GKHostedViewController requestRemoteViewControllerIfNeeded]_block_invoke_0113 + 1167
frame #3: 0x00c9e48f UIKit`__block_global_11 + 154
frame #4: 0x026cd731 libdispatch.dylib`_dispatch_barrier_sync_f_slow_invoke + 89
frame #5: 0x026dc014 libdispatch.dylib`_dispatch_client_callout + 14
frame #6: 0x026cc7d5 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 296
frame #7: 0x038bdaf5 CoreFoundation`__CFRunLoopRun + 1925
frame #8: 0x038bcf44 CoreFoundation`CFRunLoopRunSpecific + 276
frame #9: 0x038bce1b CoreFoundation`CFRunLoopRunInMode + 123
frame #10: 0x03c027e3 GraphicsServices`GSEventRunModal + 88
frame #11: 0x03c02668 GraphicsServices`GSEventRun + 104
frame #12: 0x007bfffc UIKit`UIApplicationMain + 1211 * frame #13: 0x0008c0d6 Monkey Puzzle`main(argc=1, argv=0xbffff040) + 134 at main.m:14 (lldb)
With Zombies turned on in the debug menu, the Backtrace looks slightly different
(lldb) bt
*thread #1: tid = 0x6fb94, 0x02b35286 libsystem_kernel.dylib`__kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGKILL
frame #0: 0x02b35286 libsystem_kernel.dylib`__kill + 10
frame #1: 0x02b335ec libsystem_kernel.dylib`kill$UNIX2003 + 32
frame #2: 0x03907aac CoreFoundation`___forwarding___ + 316
frame #3: 0x0390794e CoreFoundation`__forwarding_prep_0___ + 14
frame #4: 0x02230b4b GameKit`__55-[GKGameCenterViewController _setupChildViewController]_block_invoke_083 + 42
frame #5: 0x0222c896 GameKit`__61-[GKHostedViewController requestRemoteViewControllerIfNeeded]_block_invoke_0113 + 1167
frame #6: 0x00c9f48f UIKit`__block_global_11 + 154
frame #7: 0x026ce731 libdispatch.dylib`_dispatch_barrier_sync_f_slow_invoke + 89
frame #8: 0x026dd014 libdispatch.dylib`_dispatch_client_callout + 14
frame #9: 0x026cd7d5 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 296
frame #10: 0x038beaf5 CoreFoundation`__CFRunLoopRun + 1925
frame #11: 0x038bdf44 CoreFoundation`CFRunLoopRunSpecific + 276
frame #12: 0x038bde1b CoreFoundation`CFRunLoopRunInMode + 123
frame #13: 0x03c037e3 GraphicsServices`GSEventRunModal + 88
frame #14: 0x03c03668 GraphicsServices`GSEventRun + 104
frame #15: 0x007c0ffc UIKit`UIApplicationMain + 1211 * frame #16: 0x0008cba6 Monkey Puzzle`main(argc=1, argv=0xbffff00c) + 134 at main.m:14 (lldb)
When doing a Product/Profile/Zombies run, I received this after pressing the button in my menu at the 40 second mark...
Any advice please?
OK fixed it....
I have a method in a custom class that handles weather or not to bring up all leaderboards or a specific one... here is one example of how i call it...
-(void)displayLeaderboard:(id)sender
{
[[ABGameKitHelper sharedHelper] showLeaderboard:#""];
}
If i pass an empty string to it, its meant to show just the gamcenter main screen, with all the leaderboards. If i send it any string, it will show the default leaderboard ("level 1"), and if i pass it a valid leaderboardID, it will show that leaderboard....
Used to look like this...
-(void) showLeaderboard:(NSString*)leaderboardId
{
GKGameCenterViewController *gamecenterViewController = [[GKGameCenterViewController alloc]init];
GKLeaderboardViewController *leaderboardViewController = [[GKLeaderboardViewController alloc]init];
if ([leaderboardId isEqualToString:#""])
{
gamecenterViewController.viewState = GKGameCenterViewControllerStateDefault;
gamecenterViewController.gameCenterDelegate = self;
[[self topViewController] presentViewController:gamecenterViewController animated:YES completion:nil];
}
else
{
leaderboardViewController.leaderboardDelegate = self;
leaderboardViewController.category = leaderboardId;
[[self topViewController] presentViewController:leaderboardViewController animated:YES completion:nil];
}
}
This worked FINE on iOS 7, however iOS 6 would crash with the information i provided in the above question.
It turns out that the solution was to include the definition inside the if statement. I have no idea why iOS 6 isn't happy with declaring both of them, and only using one... The only reason i noticed something was us was because i saw [GKLeaderboardViewController _endDelayingPresentation]: message sent to deallocated instance 0xaac8d20 in the debug, when (although similar) i was actually always only ever needing to call the GKGameCenterViewController... So moving the declarations to within the IF statement solved this issue that would have otherwise not allowed me to deploy to iOS 6...
I would really love to read some comments on this to help me understand obj-c a little better, thanks....

Resources