Hey :) So I've been programming an app that I want to have available on the App Store. However, I have already submitted it twice with rejections concerning a crash when the app is played on an iPad (running 7.0.6 and 7.1, for both submits). The app works perfectly fine on my phone and on my mom's iPad, along with all the simulators. I also looked at the crash log (relevant info posted here):
Date/Time: 2014-03-15 14:29:04.504 -0700
OS Version: iOS 7.1 (11D167)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x182fb6950 __exceptionPreprocess + 132
1 libobjc.A.dylib 0x18f9901fc objc_exception_throw + 60
2 CoreFoundation 0x182ec0c7c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 396
3 CoreFoundation 0x182ec0ac4 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 72
4 Water Balloon 0x1000b0be4 -[WBLogic updateScoreboard:] (WBLogic.m:406)
5 Water Balloon 0x1000b0598 -[WBLogic checkCollision:] (WBLogic.m:341)
6 Water Balloon 0x1000aff10 -[WBLogic update] (WBLogic.m:231)
7 SpriteKit 0x185e47fb0 -[SKView(Private) _update:] + 236
8 SpriteKit 0x185e45ab0 -[SKView renderCallback:] + 876
9 SpriteKit 0x185e43794 __29-[SKView setUpRenderCallback]_block_invoke + 76
10 SpriteKit 0x185e62a90 -[SKDisplayLink _callbackForNextFrame:] + 288
11 QuartzCore 0x185bbccbc CA::Display::DisplayLinkItem::dispatch() + 36
12 QuartzCore 0x185bbcac8 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 300
13 IOKit 0x183eb7e74 IODispatchCalloutFromCFMessage + 364
14 CoreFoundation 0x182f682e0 __CFMachPortPerform + 192
15 CoreFoundation 0x182f76890 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
16 CoreFoundation 0x182f767f0 __CFRunLoopDoSource1 + 444
17 CoreFoundation 0x182f74a14 __CFRunLoopRun + 1620
18 CoreFoundation 0x182eb56d0 CFRunLoopRunSpecific + 452
19 GraphicsServices 0x188b51c0c GSEventRunModal + 168
20 UIKit 0x185fe6fdc UIApplicationMain + 1156
21 Water Balloon 0x1000b1c38 main (main.m:16)
22 libdyld.dylib 0x18ff83aa0 start + 4
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000019007e58c __pthread_kill + 8
1 libsystem_c.dylib 0x0000000190012804 abort + 108
2 libc++abi.dylib 0x000000018f238990 abort_message + 84
3 libc++abi.dylib 0x000000018f255c28 default_terminate_handler() + 296
4 libobjc.A.dylib 0x000000018f9904d0 _objc_terminate() + 124
5 libc++abi.dylib 0x000000018f253164 std::__terminate(void (*)()) + 12
6 libc++abi.dylib 0x000000018f252a7c __cxa_throw + 132
7 libobjc.A.dylib 0x000000018f990314 objc_exception_throw + 340
8 QuartzCore 0x0000000185bbcd7c CA::Display::DisplayLinkItem::dispatch() + 228
9 QuartzCore 0x0000000185bbcac4 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 296
10 IOKit 0x0000000183eb7e70 IODispatchCalloutFromCFMessage + 360
11 CoreFoundation 0x0000000182f682dc __CFMachPortPerform + 188
12 CoreFoundation 0x0000000182f7688c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
13 CoreFoundation 0x0000000182f767ec __CFRunLoopDoSource1 + 440
14 CoreFoundation 0x0000000182f74a10 __CFRunLoopRun + 1616
15 CoreFoundation 0x0000000182eb56cc CFRunLoopRunSpecific + 448
16 GraphicsServices 0x0000000188b51c08 GSEventRunModal + 164
17 UIKit 0x0000000185fe6fd8 UIApplicationMain + 1152
18 Water Balloon 0x00000001000b1c34 main (main.m:16)
19 libdyld.dylib 0x000000018ff83a9c start + 0
Usually a crash log would be useful in pointing out where the crash occurred, which would lead to why the crash occurred, but line 406 only points to this line in the code:
scorelabel.position = CGPointMake(width/2, height/2 + 150);
the entire method that this line is in is this:
- (void) updateScoreboard:(BOOL) on
{
if(on)
{
int w = scoreboard.size.width;
int h = scoreboard.size.height;
if(score > highScore)
{
highScore = score;
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInt:highScore] forKey:#"HighScore"];
}
[highScorelabel setText:[NSString stringWithFormat:#"High Score: %i", highScore]];
CGSize defs;
CGSize ss;
CGSize hs;
defs = [#"Score: 1" sizeWithAttributes:#{NSFontAttributeName: [UIFont fontWithName:#"04b_19" size:scorelabel.fontSize]}];
ss = [[scorelabel text] sizeWithAttributes:#{NSFontAttributeName:[UIFont fontWithName:#"04b_19" size:scorelabel.fontSize]}];
hs = [[highScorelabel text] sizeWithAttributes:#{NSFontAttributeName:[UIFont fontWithName:#"04b_19" size:highScorelabel.fontSize]}];
scorelabel.position = CGPointMake(width/2 - w/4 - defs.width/2 + ss.width/2, scoreboard.position.y + h/4);
highScorelabel.position = CGPointMake((scorelabel.position.x - ss.width/2) + hs.width/2, scorelabel.position.y - ss.height/2 - hs.height/2);
}
else
{
scorelabel.position = CGPointMake(width/2, height/2 + 150);
}
[scoreboard setHidden:!on];
[taplabel setHidden:!on];
[highScorelabel setHidden:!on];
}
I have no idea what the problem could be... Please help me find out why the app is causing their iPads to crash.
EDIT In response to the comment, height and width are determined like this:
width = scene.frame.size.width;
height = scene.frame.size.height;
Which is in - (id) init: (SKScene *) s. Also, I just found out that the entire time my app had been running with the logic scene inheriting from NSObject, not SKScene... Could that have had an influence (the app runs the same when I test it).
It is likely that the actual line of code in the symbolicated report is off by some lines. Since above the reported lines you actually do create dictionaries, and the crash is caused by an exception when creating a dictionary, it is likely that the crash happened. there.
So the lines in question are:
defs = [#"Score: 1" sizeWithAttributes:#{NSFontAttributeName: [UIFont fontWithName:#"04b_19" size:scorelabel.fontSize]}];
ss = [[scorelabel text] sizeWithAttributes:#{NSFontAttributeName:[UIFont fontWithName:#"04b_19" size:scorelabel.fontSize]}];
hs = [[highScorelabel text] sizeWithAttributes:#{NSFontAttributeName:[UIFont fontWithName:#"04b_19" size:highScorelabel.fontSize]}];
And the dictionary is always the same:
#{NSFontAttributeName:[UIFont fontWithName:#"04b_19" size:highScorelabel.fontSize]}
So as a first step you should create a local variable for that dictionary and re-use that.
Now the crash is caused when creating the dictionary, since the exception message is missing in the crash report we have to guess here. One option is that you are trying to set a key to a nil value. So when can [UIFont fontWithName:#"04b_19" size:highScorelabel.fontSize] be nil?
The documentation doesn't really say, but I'd assume this can happen if the font with a given name cannot be found. So you should check if the font is really part of the app bundle you submitted to Apple. Then check if the fontName property is set to the correct value that also works on a device. The documentation says:
The fully specified name of the font. This name incorporates both the font family name and the specific style information for the font
This thread may provide an idea what can go wrong in that case: Crash with exception attempt to insert nil object from objects[0]
Related
We are experiencing a weird issue on iOS16. There is no code change, it works fine on lower OS versions.
The stacktrace is:
The first case
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000000e5bde410
0
libobjc.A.dylib
objc_release_x21 + 16
1
CoreData
-[_PFManagedObjectReferenceQueue _processReferenceQueue:] + 1020
2
CoreData
-[NSManagedObjectContext _processRecentChanges:] + 112
3
CoreData
_performRunLoopAction + 412
4
CoreFoundation
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
5
CoreFoundation
__CFRunLoopDoObservers + 532
6
CoreFoundation
__CFRunLoopRun + 1048
7
CoreFoundation
CFRunLoopRunSpecific + 612
8
GraphicsServices
GSEventRunModal + 164
9
UIKitCore
-[UIApplication _run] + 888
10
UIKitCore
UIApplicationMain + 340
The second case, I believe this stacktrace has the same root cause as the previous one (same trend, same UI page, only happens on iOS 16).
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0033003200390070
0
libobjc.A.dylib
objc_msgSend + 32
1
CoreFoundation
-[__NSArrayM dealloc] + 188
2
MyApplication
MyClass.m - Line 361
-[MyClass loadMessages:] + 361
3
MyApplication
MyClass.m - Line 125
__74-[MyClass requestRecentMessagesAndDiscardExistingMessagesCompletion:]_block_invoke + 125
4
libdispatch.dylib
_dispatch_call_block_and_release + 32
5
libdispatch.dylib
_dispatch_client_callout + 20
6
libdispatch.dylib
_dispatch_main_queue_drain + 928
7
libdispatch.dylib
_dispatch_main_queue_callback_4CF + 44
8
CoreFoundation
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
9
CoreFoundation
__CFRunLoopRun + 2036
10
CoreFoundation
CFRunLoopRunSpecific + 612
11
GraphicsServices
GSEventRunModal + 164
12
UIKitCore
-[UIApplication _run] + 888
13
UIKitCore
UIApplicationMain + 340
MyClass.m is an Objective-C class, it has a property:
#property (nonatomic, strong) NSArray<Message *> *messages; // Message is NSManagedObject
In the second stacktrace, frame -[OurClass loadMessages:] + 361, the messages array is deallocated:
self.messages = [[NSArray alloc] init...];
So my guess is, somehow the messages are over-released. If the messages are released in MyClass before, then the crash happens as the first stacktrace, otherwise it happens as the second stacktrace.
I've turned on -com.apple.CoreData.ConcurrencyDebug 1 to try to debug this, but no luck.
Any help would be much appreciated. Thanks in advance!
My app crashed about 200 times per month on iOS 15, and I failed to solve it.
The crash reports shows like following:
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000001f12d313c
Thread 0 Crashed:
0 libsystem_platform.dylib 0x00000001f12d313c _os_unfair_lock_corruption_abort + 88
1 libsystem_platform.dylib 0x00000001f12cda20 _os_unfair_lock_lock_slow + 320
2 QuartzCore 0x000000018441c7c4 CA::Display::DisplayTimingsControl::granularity+ 100292 (unsigned int) + 40
3 QuartzCore 0x000000018456b99c CA::Display::DisplayLink::timer_status_callback+ 1472924 (_CADisplayTimer*, CADisplayTimerAction, unsigned long long, unsigned long long, void*) + 692
4 QuartzCore 0x000000018441b678 display_timer_callback+ 95864 (__CFMachPort*, void*, long, void*) + 272
5 CoreFoundation 0x00000001806bf390 __CFMachPortPerform + 176
6 CoreFoundation 0x0000000180702724 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60
7 CoreFoundation 0x0000000180705f30 __CFRunLoopDoSource1 + 596
8 CoreFoundation 0x00000001806bfe0c __CFRunLoopRun + 2380
9 CoreFoundation 0x00000001806d33b8 CFRunLoopRunSpecific + 600
10 GraphicsServices 0x000000019c06338c GSEventRunModal + 164
11 UIKitCore 0x00000001830736a8 0x182b5a000 + 5346984
12 UIKitCore 0x0000000182df27f4 UIApplicationMain + 2092
13 IBUWireless 0x0000000104700584 main + 17796 (main.m:44)
14 (null) 0x00000001083d9a24 0x0 + 4433222180
I guess it's because a CADisPlayLink has been dealloced wrongly, but I can't figure out which one.
The source code of apple's lock is https://github.com/apple/darwin-libplatform/blob/main/src/os/lock.c
Is Apple's CADisplayLayer Opensourced? How can I fix this crash?
This crash occurs due to a dangling pointer. When any variable or object is trying to access an object that's already been deallocated, this crash occurs.
check code and trace line by line.
We encountered an OpenGL related crash on ios14. It has nothing to do with the application background. The vast majority of crashes occurred on IOS 14 low-end devices, and it is not clear how to solve them.
The only possible clue is that the crash may have something to do with opening the WebView.
Monitor Type: Unix Signal
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000 at 0x00000001c7517414
Crashed Thread: 0
Pthread id: 10322737
Thread 0 Crashed:
0 libsystem_kernel.dylib __pthread_kill + 8
1 libsystem_pthread.dylib pthread_kill + 272
2 libsystem_c.dylib abort + 104
3 AppleMetalGLRenderer GLDContextRec::flushContextInternal() + 852
4 GLEngine gliPresentViewES_Exec + 188
5 OpenGLES -[EAGLContext presentRenderbuffer:] + 76
6 myapp -[EJCanvasContextWebGLScreen present] (EJCanvasContextWebGLScreen.m:142)
7 QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 664
8 QuartzCore display_timer_callback(__CFMachPort*, void*, long, void*) + 280
9 CoreFoundation __CFMachPortPerform + 176
10 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60
11 CoreFoundation __CFRunLoopDoSource1 + 596
12 CoreFoundation __CFRunLoopRun + 2360
13 CoreFoundation CFRunLoopRunSpecific + 600
14 GraphicsServices GSEventRunModal + 164
15 UIKitCore -[UIApplication _run] + 1072
16 UIKitCore UIApplicationMain + 168
17 myapp main (main.m:36)
18 libdyld.dylib start + 4
I'm 100% sure presentRenderBuffer works fine in iOS14.
According to the error message, it seems like a thread issue.
In my case, I use a queue to detail with all of the OpenGL things.
dispatch_sync(queue, ^{
// All of the OpenGL things
[self bindCurrentRenderBuffer];
[self presentRenderBuffer];
});
You can see my OpenGL project in Github: IRPlayer
I am using UIWebViews in some of the screens, because I need a perfect Html text parsing.
According to crash reports a huge number of crashes, called WTF Crash, occur on these screens. Here is a trace of that crash
Crashed: WebThread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000000bbadbeef
Thread : Crashed: WebThread
0 JavaScriptCore 0x184fd2710 WTFCrash + 72
1 JavaScriptCore 0x184fd2708 WTFCrash + 64
2 WebCore 0x1852b7d78 <redacted> + 362
3 WebCore 0x1852b7bec <redacted> + 44
4 CoreFoundation 0x1817d8588 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
5 CoreFoundation 0x1817d632c __CFRunLoopDoObservers + 372
6 CoreFoundation 0x1817d6674 __CFRunLoopRun + 696
7 CoreFoundation 0x181705680 CFRunLoopRunSpecific + 384
8 WebCore 0x1852b5998 <redacted> + 456
9 libsystem_pthread.dylib 0x18148bb28 <redacted> + 156
10 libsystem_pthread.dylib 0x18148ba8c _pthread_start + 154
11 libsystem_pthread.dylib 0x181489028 thread_start + 4
There is no OS version, or device relation on this crash.
I am not doing anything fancy on using UIWebView as well. It is added to nib like every other component, and in the implementation file I use it like the following
self.webView.scrollView.scrollEnabled = NO;
self.webView.scrollView.bounces = NO;
self.webView.opaque = NO;
self.webView.backgroundColor = [UIColor clearColor];
self.webView.delegate = self;
[self.webView loadHTMLString:htmlString baseURL:nil];
Any suggestions on how to solve WTF Crash?
Edit: Here is how htmlString looks like
Printing description of htmlString:
<html><body style="font-family:HelveticaNeue; font-size:10; background-color:#E5E4E4; text-align:left; color:#696969 ">test string</body></html>
I don't know how you are creating your UIWebView. But I was having a similiar issue with a WTFCrash and I was able to solve it by making sure that the UIWebView was being created on the main thread:
- (void)createWebView{
if (![NSThread isMainThread]) {
dispatch_async(dispatch_get_main_queue(), ^{
[self createWebView];
});
return;
}
self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];
//Rest of my code
}
Are you debugging your web view with Safari? If yes, the crash should be gone after you quit Safari.
I was facing a similar crash with WKWebView, and I was sure the same code worked happily 3 days ago. hlung's comments saved me, you can find it HERE.
For your reference, following is a piece of the crash log in my case.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000dbbdfb10
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 Crashed:
0 JavaScriptCore 0x225d74c6 WTF::HashSet<JSC::MarkedArgumentBuffer*, WTF::PtrHash<JSC::MarkedArgumentBuffer*>, WTF::HashTraits<JSC::MarkedArgumentBuffer*> >::remove(JSC::MarkedArgumentBuffer* const&) + 54
1 JavaScriptCore 0x22620b41 JSC::VM::~VM() + 211
2 JavaScriptCore 0x22197e57 JSC::JSLockHolder::~JSLockHolder() + 73
3 JavaScriptCore 0x2248defd JSContextGroupRelease + 61
4 JavaScriptCore 0x2250e37d -[JSVirtualMachine dealloc] + 27
5 libobjc.A.dylib 0x1dac5195 objc_object::sidetable_release(bool) + 239
6 JavaScriptCore 0x2248d261 -[JSContext dealloc] + 125
7 libobjc.A.dylib 0x1dac5195 objc_object::sidetable_release(bool) + 239
8 JavaScriptCore 0x226470af WTF::RunLoop::TimerBase::timerFired(__CFRunLoopTimer*, void*) + 25
9 CoreFoundation 0x1e807357 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 15
10 CoreFoundation 0x1e807029 __CFRunLoopDoTimer + 897
11 CoreFoundation 0x1e8069e1 __CFRunLoopDoTimers + 221
12 CoreFoundation 0x1e804cc5 __CFRunLoopRun + 1365
13 CoreFoundation 0x1e754073 CFRunLoopRunSpecific + 487
14 CoreFoundation 0x1e753e81 CFRunLoopRunInMode + 105
15 GraphicsServices 0x1ff00bfd GSEventRunModal + 157
16 UIKit 0x2390e82f -[UIApplication _run] + 575
17 UIKit 0x23908f61 UIApplicationMain + 151
18 MyApp 0x00488b29 0x2c000 + 4573993
19 libdyld.dylib 0x1df1e50b start + 3
WebKit, the engine behind Web Views, can raise a crash when it sees a memory problem.
These are identified by the special Hex Word 0x00000000bbadbeef as you have found.
The web page you are visiting seems trivial, so it is a surprise that you are having problems. I recommend you follow the WebKit debugging facilities described at:
https://webkit.org/debugging-webkit/#ios-simulator
Please update your question with any logs or insights this reveals.
It was a Google Ads issue, already fixed for sure on version 7.35.0 of October, 17 and newer versions.
You should be able to fix the issue updating your pod.
From the Google Mobile Ads SDK Developers Team mailing:
"The issue has been fixed by the team and it should go live in an upcoming SDK release (release notes)." (August, 20)
"Issue has been fixed and live already." (October, 17)
Source: https://groups.google.com/d/msg/google-admob-ads-sdk/XL35wo6mQts/R2LlGZDxBwAJ
Release Notes: https://developers.google.com/admob/ios/rel-notes
I am working on and app called whereami from the "BNR Guide to iOS programming" chapter 5. I have the app working and left it on my phone to show the wife and family I am learning stuff. It is exhibiting a regular crashing behavior though. Here is what happens....
When you first open app and run it it does fine,
If you hit home and then open it again within just a few minutes it does fine,
If you leave it in the background then reopen more than a few minutes (say like 5 or more) later it crashes.
You can then reopen it then and it does fine but the pattern repeats.
I have double checked all my code with the book and looked on the errata page but can't figure out what could be wrong. The Xcode organizer shows logs for all the crashes but I don't know how to read that yet. I was starting to wonder if since this is just a learning project app, not meant for real use, maybe it is missing something that makes it multitask/background/reopen??? correctly? I am using Xcode 4.1 on Lion with iPhone 4 running iOS 4.3.4. I would be grateful for any assistance anyone can offer.
Here is what I think is the relevant part of the crash log:
Incident Identifier: 352B538C-75BB-4BDF-9C2B-EC9613CE1B44
CrashReporter Key: 5896ed7851b999169919cab30c69940f74ed6b0c
Hardware Model: iPhone3,1
Process: WhereAmI [775]
Path: /var/mobile/Applications/DB57A854-01F8-460F-B8CD-38B8FC50FBAF/WhereAmI.app/WhereAmI
Identifier: WhereAmI
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2011-07-23 18:47:19.093 -0400
OS Version: iPhone OS 4.3.4 (8K2)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x356d8a1c __pthread_kill + 8
1 libsystem_c.dylib 0x34d543b4 pthread_kill + 52
2 libsystem_c.dylib 0x34d4cbf8 abort + 72
3 libstdc++.6.dylib 0x35434a64 __gnu_cxx::__verbose_terminate_handler() + 376
4 libobjc.A.dylib 0x35fdd06c _objc_terminate + 104
5 libstdc++.6.dylib 0x35432e36 __cxxabiv1::__terminate(void (*)()) + 46
6 libstdc++.6.dylib 0x35432e8a std::terminate() + 10
7 libstdc++.6.dylib 0x35432f5a __cxa_throw + 78
8 libobjc.A.dylib 0x35fdbc84 objc_exception_throw + 64
9 CoreFoundation 0x3504d3c6 -[NSException raise] + 2
10 MapKit 0x3389bcb2 -[MKMapView setRegion:animated:] + 318
11 WhereAmI 0x000029cc -[WhereAmIAppDelegate mapView:didUpdateUserLocation:] (WhereAmIAppDelegate.m:52)
12 MapKit 0x338a11b6 -[MKMapView(UserPositioningInternal) resetUserLocation] + 142
13 MapKit 0x338a074e -[MKMapView(UserPositioningInternal) locationManagerDidReset:] + 22
14 CoreFoundation 0x34fbaefc -[NSObject(NSObject) performSelector:withObject:] + 16
15 CoreFoundation 0x34ff82f2 -[NSArray makeObjectsPerformSelector:withObject:] + 394
16 MapKit 0x33893802 -[MKLocationManager _reportLocationStatus:] + 34
17 MapKit 0x338937ce -[MKLocationManager _reportLocationReset] + 14
18 MapKit 0x33894d24 -[MKLocationManager reset] + 88
19 MapKit 0x338770a2 -[MKLocationManager applicationResumed:] + 62
20 Foundation 0x30fa017c _nsnote_callback + 136
21 CoreFoundation 0x3501c208 __CFXNotificationPost_old + 396
22 CoreFoundation 0x34fb6ee4 _CFXNotificationPostNotification + 112
23 Foundation 0x30f9d5cc -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
24 UIKit 0x3640f720 -[UIApplication _handleApplicationResumeEvent:] + 900
25 UIKit 0x362b9e20 -[UIApplication handleEvent:withNewEvent:] + 2724
26 UIKit 0x362b920e -[UIApplication sendEvent:] + 38
27 UIKit 0x362b8c4c _UIApplicationHandleEvent + 5084
28 GraphicsServices 0x35827e70 PurpleEventCallback + 660
29 GraphicsServices 0x35827efa PurpleEventSignalCallback + 10
30 CoreFoundation 0x35024a72 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
31 CoreFoundation 0x35026758 __CFRunLoopDoSources0 + 376
32 CoreFoundation 0x350274e4 __CFRunLoopRun + 224
33 CoreFoundation 0x34fb7ebc CFRunLoopRunSpecific + 224
34 CoreFoundation 0x34fb7dc4 CFRunLoopRunInMode + 52
35 GraphicsServices 0x35827418 GSEventRunModal + 108
36 GraphicsServices 0x358274c4 GSEventRun + 56
37 UIKit 0x362e3d62 -[UIApplication _run] + 398
38 UIKit 0x362e1800 UIApplicationMain + 664
39 WhereAmI 0x000027c0 main (main.m:14)
40 WhereAmI 0x00002768 start + 32
I am very new at this but I am guessing that the last function called is here:
8 libobjc.A.dylib 0x35fdbc84 objc_exception_throw + 64
9 CoreFoundation 0x3504d3c6 -[NSException raise] + 2
10 MapKit 0x3389bcb2 -[MKMapView setRegion:animated:] + 318
11 WhereAmI 0x000029cc -[WhereAmIAppDelegate mapView:didUpdateUserLocation:] (WhereAmIAppDelegate.m:52)
the method code from WhereAmIAppDelegate.m is here:
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation{
// Zoom in on user here
CLLocationCoordinate2D loc = [userLocation coordinate];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(loc, 250, 250);
[worldView setRegion:region animated:YES];
}
I ran into this problem with the 3rd edition of the book and saw it was answered in the book's 2nd edition forums, but not here. The problem is that the WhereAmIAppDelegate receives an invalid location when the app returns from running in the background for more than 5-10 minutes. Not sure why this happens, but this is how I fixed it:
- (void)mapView:(MKMapView *)mapView
didUpdateUserLocation:(MKUserLocation *)userLocation
{
// Here we are... but how do we actually zoom?
CLLocationCoordinate2D loc = [userLocation coordinate];
if(CLLocationCoordinate2DIsValid(loc))
{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(loc, 320, 480);
[worldView setRegion:region animated:YES];
}
}
Sorry to "necro" an old thread, but I thought this might help somebody looking for help. By the way, I'm using Xcode 4.3.2 and iOS 5.1.
try checking if the region has some value. Also change 250 to 250.0. Give me some feedback. :)