location manager crasehs app when asking for permission

Discussion in 'iOS Programming' started by drivefast, Jun 21, 2009.

  1. drivefast macrumors regular

    Mar 13, 2008
    my app's delegate starts the location manager on applicationDidFinishLaunching. it briefly displays the screen i would be expecting to see, briefly shows the dialog box that asks the user if they're ok with using the location manager, and then it crashes with no application console message (on the device console i can see some launchd messages but i assume those are only indicating that the app has crashed). however everything works as expected if:
    - i put a breakpoint on the last line of applicationDidFinishLaunching, accept the location manager usage, and then continue from the breakpoint
    - i approved the location manager usage twice, so the app is not asking for permission anymore
    - i disable the location manager in the device's settings -> general

    so practically the only time it crashes is when it needs the user to accept the usage of the location manager. (which is why i didnt discover it for a very long time). i have a feeling this started to happen since i added a mapview object in my app, but this is unconfirmed. anybody has any ideas for a workaround?
  2. kainjow Moderator emeritus


    Jun 15, 2000
    Can you post some code? Sounds like there might be a memory management issue. I'd be surprised if there was a crasher bug in Apple's code at this point after so many betas.
  3. drivefast thread starter macrumors regular

    Mar 13, 2008
    thanks for offering to help. the code in my main app is pretty big and unrelated to this particular subject, i'm already working to reproduce the same thing in a smaller tester. i agree with you, i give it 90% chance that the bug is on me, unless apple opened a can of worms with their map view.
    later edit:
    well, it turns out that the problem is in my app. i built a tester that was doing what i suspected was wrong, and the same sequence of operation worked. that's good - i hate it when the bug is in someone else's code. yet i'm still clueless at what can be the difference when the dialog box asking the user to accept the location service shows up.
  4. drivefast thread starter macrumors regular

    Mar 13, 2008
    related to the incident described, this is what i get on the device console. can anybody make any sense of it?
    Sun Jun 21 21:51:58 unknown kernel[0] <Debug>: AppleSerialMultiplexer: !! mux-ad(eng)::bsdIoctlunrecognized ioctl on minor 12 (0x402c7413), data (0xea5ffedc, @int=0x00000000),fflag (0x00000007), ret 0xe3ff8001
    Sun Jun 21 21
    :51:58 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.xxxx.yyyy[0xe6cd]) Buglaunchd_core_logic.c:2649 (23909):10
    Sun Jun 21 21
    :51:58 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.xxxx.yyyy[0xe6cd]) Working around 5020256. Assuming the job crashed.
    Sun Jun 21 21:51:58 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:com.xxxx.yyyy[0xe6cd]) Job appears to have crashedSegmentation fault
    Sun Jun 21 21
    :51:58 unknown com.apple.debugserver-42[83] <Warning>: [0053/1203]: error: ::read 70xc891c1024 ) => -1 err Bad file descriptor (0x00000009)
    Sun Jun 21 21:51:58 unknown SpringBoard[24] <Warning>: Application 'xxxx' exited abnormally with signal 11Segmentation fault
    it looks like the offending command is [gps startUpdatingLocation] (gps is my CLLocation object); it actually returns immediately (nonblocking), but it crashes the app later on. reason i'm saying that it is the offending command is because if i comment it out, everything works fine. and again, it crashes only when the OS has to ask for location manager permissions - if the permissions were already granted everything's OK.
  5. jdandrea macrumors newbie

    Sep 10, 2003
    New Jersey, US

Share This Page