iPhone crash only when device not connected to xcode, how to understand the crash log?

痞子三分冷 提交于 2019-12-10 10:49:06

问题


On a device running ios 5 my app works great, but on a device running ios 4.2.1 i get this crash. The strange thing is that the device crash only when NOT connected to xcode. When run from xcode it work but when i run it without xcode the app is working till the moment i call the method:

- (void)startLocationUpdates
{
    self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
    self.locationManager.distanceFilter = 1;
    self.locationManager.delegate = self;
    [self.locationManager startUpdatingLocation];
} 

CRASH LOG:

OS Version:      iPhone OS 4.2.1 (8C148)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x3830000f
Crashed Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib                 0x33479462 objc_msgSend + 14
1   CoreLocation                    0x34371430 -[CLLocationManager onClientEventLocation:] + 560
2   CoreLocation                    0x3436f68e -[CLLocationManager onClientEvent:supportInfo:] + 98
3   CoreLocation                    0x3436f804 OnClientEvent + 16
4   CoreLocation                    0x3436b522 CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 42
5   CoreLocation                    0x3436d3cc CLClientHandleDaemonDataLocation(__CLClient*, CLClientLocation const*, __CFDictionary const*) + 196
6   CoreLocation                    0x3436d512 CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 286
7   CoreFoundation                  0x33a813fe __CFMessagePortPerform + 242
8   CoreFoundation                  0x33a556f8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
9   CoreFoundation                  0x33a556bc __CFRunLoopDoSource1 + 160
10  CoreFoundation                  0x33a47f76 __CFRunLoopRun + 514
11  CoreFoundation                  0x33a47c80 CFRunLoopRunSpecific + 224
12  CoreFoundation                  0x33a47b88 CFRunLoopRunInMode + 52
13  GraphicsServices                0x33b0e4a4 GSEventRunModal + 108
14  GraphicsServices                0x33b0e550 GSEventRun + 56
15  UIKit                           0x32099322 -[UIApplication _run] + 406
16  UIKit                           0x32096e8c UIApplicationMain + 664
17  MyApp                       0x00002762 0x1000 + 5986
18  MyApp                       0x00002720 0x1000 + 5920

回答1:


Are you sure that self is living all the time you use it and you set self.locationManager.delegate = nil; before you destroy self?




回答2:


if you have had your device serviced AFTER it was included in your provisioning profile, this MIGHT happen (at least on xcode 4.2).

first, check to see if your phone's "name" matches the "name" in your profile (when last updated in xcode).

  1. open Xcode
  2. click on ORGANIZER

  3. choose DEVICES

  4. under LIBRARY, click PROVISINING PROFILES
  5. read the header for the iOS TEAM PROVISIONING PROFILE (you should have a list of device "names")
  6. your last connected device should be listed under devices (even if it isnt connected at the moment)

check to see if your device is listed (in your provisioning profile) with the same "name" that Xcode reads on it

i solved my problem by

  1. going online @ developer.apple.com,
  2. logging into the member area,
  3. choosing iOS developer,
  4. then picking CERTIFICATES, ETC on the right hand menu and
  5. editing the the device from my provisioning profile.

  6. IN XCODE, in the PROVISIONING PROFILES window (previous image), click REFRESH (bottom right)

alternatively, you could disable (sorta like delete) the device from your provisioning profiles (in developer.apple.com) and then starting all over, like with a "new" device. but apple is real picky about developer behavior, i wouldnt go around deleting and recreating devices because they might start doing human interference on your approvals and that will eat up your clock.

clearing your keychain, especially if you find things like com.apple.kerberos.kdc com.apple.systemdefault might be an other solution, espec ially if XCODE IS CRASHING ON ITS OWN (Xcode sometimes crashes because of keychain trash).

last resort, reinstall xcode (you know apple, if it aint working and deleting preferences doesnt solve it, reinstall it).



来源:https://stackoverflow.com/questions/8251429/iphone-crash-only-when-device-not-connected-to-xcode-how-to-understand-the-cras

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!