If this is not the right forum to ask such question, please point me to the right one.
The app I am working on uses the location of the user and alert the user when certain condition is met. The alert is in form of vibration and a playback of a small file. During testing on the device, the phone vibrates and the audio clip plays for 2 seconds (the clip is about 9 secs long) and the app crashes. The crashes are consistent on the device. On the simulator, occasionally, I see the crashes but not consistent.
The trigger to set off the alert is in the delegate method of CLLocation class - (void)locationManager:manager didUpdateToLocation:fromLocation:
Here's the code fragment (ivLocMgr is an instance variable)
if ((!ivAlertAlreadyShown) && (<test for trigger condition)) {
ivAlertAlreadyShown = YES;
[self obviousNotification];
[ivLocMgr stopUpdatingLocation];
[ivLocMgr release], ivLocMgr = nil;
}
Can the [ivLocMgr stopUpdatingLocation]; be the root cause?
Any and all help is greatly appreciated. -S-
Incident Identifier: 8875BB08-4DAD-4FC7-8DC6-AA5D52D6FC78
CrashReporter Key: f995a257bad99baa2fcf0f7d5b0ab3e77dce3a91
Hardware Model: iPhone2,1
Process: SAlert [360]
Path: /var/mobile/Applications/D3B5BAED-036C-4CFE-A735-A61D6ECCDAF6/SAlert.app/SpAlert
Identifier: SAlert
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2011-08-30 07:35:41.206 -0700
OS Version: iPhone OS 4.2.1 (8C148a)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x46924508
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x3199f464 objc_msgSend + 16
1 CoreLocation 0x30e1f430 -[CLLocationManager onClientEventLocation:] + 560
2 CoreLocation 0x30e1d68e -[CLLocationManager onClientEvent:supportInfo:] + 98
3 CoreLocation 0x30e1d804 OnClientEvent + 16
4 CoreLocation 0x30e19522 CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 42
5 CoreLocation 0x30e1b3cc CLClientHandleDaemonDataLocation(__CLClient*, CLClientLocation const*, __CFDictionary const*) + 196
6 CoreLocation 0x30e1b512 CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 286
7 CoreFoundation 0x314913fe __CFMessagePortPerform + 242
8 CoreFoundation 0x314656f8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
9 CoreFoundation 0x3146开发者_如何学运维56bc __CFRunLoopDoSource1 + 160
10 CoreFoundation 0x31457f76 __CFRunLoopRun + 514
11 CoreFoundation 0x31457c80 CFRunLoopRunSpecific + 224
12 CoreFoundation 0x31457b88 CFRunLoopRunInMode + 52
13 GraphicsServices 0x35d664a4 GSEventRunModal + 108
14 GraphicsServices 0x35d66550 GSEventRun + 56
15 UIKit 0x338d5322 -[UIApplication _run] + 406
16 UIKit 0x338d2e8c UIApplicationMain + 664
17 StopAlert 0x00002f76 0x1000 + 8054
18 StopAlert 0x00002f40 0x1000 + 8000
Thread 1:
0 libSystem.B.dylib 0x31192974 kevent + 24
1 libSystem.B.dylib 0x3123c704 _dispatch_mgr_invoke + 88
2 libSystem.B.dylib 0x3123c174 _dispatch_queue_invoke + 96
3 libSystem.B.dylib 0x3123bb98 _dispatch_worker_thread2 + 120
4 libSystem.B.dylib 0x311e024a _pthread_wqthread + 258
5 libSystem.B.dylib 0x311d8970 start_wqthread + 0
Thread 2:
0 libSystem.B.dylib 0x31166268 mach_msg_trap + 20
1 libSystem.B.dylib 0x31168354 mach_msg + 44
2 CoreFoundation 0x31458648 __CFRunLoopServiceMachPort + 88
3 CoreFoundation 0x31457ed2 __CFRunLoopRun + 350
4 CoreFoundation 0x31457c80 CFRunLoopRunSpecific + 224
5 CoreFoundation 0x31457b88 CFRunLoopRunInMode + 52
6 WebCore 0x33d9f124 RunWebThread(void*) + 332
7 libSystem.B.dylib 0x311df886 _pthread_start + 242
8 libSystem.B.dylib 0x311d4a88 thread_start + 0
Thread 3:
0 libSystem.B.dylib 0x31166268 mach_msg_trap + 20
1 libSystem.B.dylib 0x31168354 mach_msg + 44
2 CoreFoundation 0x31458648 __CFRunLoopServiceMachPort + 88
3 CoreFoundation 0x31457ed2 __CFRunLoopRun + 350
4 CoreFoundation 0x31457c80 CFRunLoopRunSpecific + 224
5 CoreFoundation 0x31457b88 CFRunLoopRunInMode + 52
6 Foundation 0x31cf15f6 +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] + 206
7 Foundation 0x31ccf192 -[NSThread main] + 38
8 Foundation 0x31cc8242 __NSThread__main__ + 966
9 libSystem.B.dylib 0x311df886 _pthread_start + 242
10 libSystem.B.dylib 0x311d4a88 thread_start + 0
Thread 4:
0 libSystem.B.dylib 0x3118a68c select$DARWIN_EXTSN + 20
1 CoreFoundation 0x3148f662 __CFSocketManager + 582
2 libSystem.B.dylib 0x311df886 _pthread_start + 242
3 libSystem.B.dylib 0x311d4a88 thread_start + 0
Thread 5:
0 libSystem.B.dylib 0x31166268 mach_msg_trap + 20
1 libSystem.B.dylib 0x31168354 mach_msg + 44
2 CoreFoundation 0x31458648 __CFRunLoopServiceMachPort + 88
3 CoreFoundation 0x31457ed2 __CFRunLoopRun + 350
4 CoreFoundation 0x31457c80 CFRunLoopRunSpecific + 224
5 CoreFoundation 0x31457b88 CFRunLoopRunInMode + 52
6 MapKit 0x347a2906 TileCachePrivate::runCacheThread() + 274
7 MapKit 0x347a27ea _runCacheThread(void*) + 2
8 libSystem.B.dylib 0x311df886 _pthread_start + 242
9 libSystem.B.dylib 0x311d4a88 thread_start + 0
Thread 6:
0 libSystem.B.dylib 0x311de9f0 __semwait_signal + 24
1 libSystem.B.dylib 0x311937ec _pthread_cond_wait + 748
2 libSystem.B.dylib 0x311933d2 pthread_cond_wait + 26
3 QuartzCore 0x30a925dc CA::DispatchGroup::thread(void*) + 84
4 QuartzCore 0x30a5f01a thread_fun + 10
5 libSystem.B.dylib 0x311df886 _pthread_start + 242
6 libSystem.B.dylib 0x311d4a88 thread_start + 0
Thread 7:
0 libSystem.B.dylib 0x31166268 mach_msg_trap + 20
1 libSystem.B.dylib 0x31168354 mach_msg + 44
2 libSystem.B.dylib 0x3118af5a thread_policy + 118
3 libSystem.B.dylib 0x3118aed2 pthread_setschedparam_internal + 62
4 libSystem.B.dylib 0x3118ae0e pthread_setschedparam + 70
5 TextInput 0x31e8128a KB::kb_set_thread_priority(int) + 18
6 TextInput 0x31e71f74 KB::BackgroundLoad(void*) + 84
7 libSystem.B.dylib 0x311df886 _pthread_start + 242
8 libSystem.B.dylib 0x311d4a88 thread_start + 0
Thread 0 crashed with ARM Thread State:
r0: 0x0403000f r1: 0x33baf8ef r2: 0x30e4bff6 r3: 0x00000001
r4: 0x46924500 r5: 0x30e1d7f5 r6: 0x00a01c64 r7: 0x2fdfec44
r8: 0x00000000 r9: 0x040fc098 r10: 0x00000000 r11: 0x00000000
ip: 0x3e16c584 sp: 0x2fdfeaa0 lr: 0x30e1f437 pc: 0x3199f464
cpsr: 0x200f0030
Found the answer on Apple Developers' Forum:
I needed to set the coreLocation instance's delegate to nil, when the alarm was triggered.
There isn't enough code there to properly determine the cause of the abort. The error you are getting is telling you that you are trying to access a variable that has already been released. I would start there and make sure you haven't released your location manager or some other variable there.
精彩评论