3

Possible Duplicate:
I get error 0x8badf00d in iPhone app, and is not the usual suspect

This is my first post here, so if you think I am doing something wrong, please tell me ;D

First of all, I've been doing research with no success, and I can't figure out what's happening.

I'm developing a universal app and it has worked well on every device I used to test it (iPhone 3GS, iPhone 4, iPhone 4S, iPad 2 and iPod Touch 4G). But some customers have reported the app closes at launch (also in different models and iOS versions, so there seems there isn't a common factor. I mean, the app does not fail only in a specific device model/iOS version).

One of them was so kind that he gave me the crash reporter. It appeared to be a common 0x8badf00d problem (I'll have to optimize the startup somehow so that the didFinishLaunchingWithOptions returns as fast as possible, I know). Restarted the device, closed the other apps in background/suspended and then it worked. Here it is that crash reporter (I don't know why it hasn't been symbolicated with the same degree as the second crash reporter posted below. I imported it on the Xcode organizer and I have the necessary files to symbolicate):

Date/Time:       2012-05-15 00:42:19.074 +0200
OS Version:      iPhone OS 5.0.1 (9A405)
Report Version:  104

Exception Type:  00000020
Exception Codes: 0x8badf00d
Highlighted Thread:  0

Application Specific Information:
com.myApp.free failed to resume in time

Elapsed total CPU time (seconds): 2.400 (user 2.400, system 0.000), 12% CPU 
Elapsed application CPU time (seconds): 0.073, 0% CPU 

Last Exception Backtrace:
0                                   0x3293a8bf  + 848537791
1                                   0x356021e5  + 895492581
2                                   0x32883b6b  + 847788907
3   myApp                           0x0000a82d -[PhoneViewController requestFinished:] (PhoneViewController.m:1679)
4                                   0x3289922b  + 847876651
5   myApp                           0x0002a0b1 -[ASIHTTPRequest reportFinished] (ASIHTTPRequest.m:2028)
6                                   0x3289922b  + 847876651
7                                   0x31fc2757  + 838608727
8                                   0x3290eb03  + 848358147
9                                   0x3290e365  + 848356197
10                                  0x3290d075  + 848351349
11                                  0x328904dd  + 847840477
12                                  0x328903a5  + 847840165
13                                  0x335a8fcd  + 861573069
14                                  0x36953743  + 915748675
15  myApp                           0x000033af main (main.m:27)
16  myApp                           0x00003368 0x1000 + 9064


Thread 0:
0   ???                               0x3465c32c 0 + 879084332
1   ???                               0x35e77fe6 0 + 904364006
2   ???                               0x336cbf66 0 + 862764902
3   ???                               0x336c9348 0 + 862753608
4   ???                               0x356022de 0 + 895492830
5   ???                               0x336c93c0 0 + 862753728
6   ???                               0x336c944c 0 + 862753868
7   ???                               0x336ca820 0 + 862758944
8   ???                               0x35602230 0 + 895492656
9   ???                               0x32890540 0 + 847840576
10  ???                               0x328903a0 0 + 847840160
11  ???                               0x335a8fc8 0 + 861573064
12  ???                               0x3695373e 0 + 915748670
13  myApp                           0x000033aa main (main.m:27)
14  myApp                           0x00003364 0x1000 + 9060

Later one of my mates here brought an iPhone 4 in which the app didn't work, apparently because of the same problem. The crash reporter shown 0x8badf00d as well, but the previous rebooting 'solution' didn't work. Besides, there was a difference between these two crashes: The first one crashed in a few seconds while the splash image was showing up, while the second one took much more time (I did several tries and it remained slower than the first one). I plugged the iPhone to see what was happening in the Xcode console (posted some lines after the crash reporter). Here is the crash reporter...

Date/Time:       2012-05-15 11:57:30.227 +0200
OS Version:      iPhone OS 5.1 (9B176)
Report Version:  104

Exception Type:  00000020
Exception Codes: 0x8badf00d
Highlighted Thread:  0

Application Specific Information:
com.myApp.free failed to launch in time

Elapsed total CPU time (seconds): 12.410 (user 12.410, system 0.000), 63% CPU 
Elapsed application CPU time (seconds): 7.302, 37% CPU

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   libsystem_kernel.dylib          0x35069dcc __open + 8
1   DataDetectorsCore               0x30c8ca60 DDmmap + 8
2   DataDetectorsCore               0x30c860ea DDCacheCreateFromFileAtPathWithExtraChecks + 14
3   DataDetectorsCore               0x30c860b8 DDCacheCreateFromSystemCache + 1252
4   DataDetectorsCore               0x30c85a16 DDScannerCreateWithType + 14
5   DataDetectorsCore               0x30c85aaa DDScannerCreate + 6
6   Foundation                      0x3118cac8 -[NSDataDetector initWithTypes:error:] + 960
7   Foundation                      0x3118c6ec +[NSDataDetector dataDetectorWithTypes:error:] + 44
8   myApp                           0x00004c0c -[PhoneViewController getTelfNumbers] (PhoneViewController.m:213)
9   myApp                           0x00007062 -[PhoneViewController viewDidLoad] (PhoneViewController.m:864)
10  UIKit                           0x32479e3e -[UIViewController awakeFromNib] + 106
11  UIKit                           0x3250c2ec -[UINib instantiateWithOwner:options:] + 1236
12  UIKit                           0x3247a4ac -[UIViewController _loadViewFromNibNamed:bundle:] + 240
13  UIKit                           0x32357dfa -[UIViewController loadView] + 82
14  UIKit                           0x322cddb8 -[UIViewController view] + 44
15  UIKit                           0x3232d7de -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 86
16  UIKit                           0x3232d77c -[UITabBarController transitionFromViewController:toViewController:] + 24
17  UIKit                           0x3232d0b6 -[UITabBarController _setSelectedViewController:] + 294
18  UIKit                           0x3232cdea -[UITabBarController setSelectedIndex:] + 234
19  myApp                           0x00003f1e -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:294)
20  UIKit                           0x322cce4c -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1176
21  UIKit                           0x322c697e -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 402
22  UIKit                           0x32294c64 -[UIApplication handleEvent:withNewEvent:] + 1004
23  UIKit                           0x32294708 -[UIApplication sendEvent:] + 48
24  UIKit                           0x322940dc _UIApplicationHandleEvent + 5820
25  GraphicsServices                0x364c9224 PurpleEventCallback + 876
26  CoreFoundation                  0x3524a51c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
27  CoreFoundation                  0x3524a4be __CFRunLoopDoSource1 + 134
28  CoreFoundation                  0x3524930c __CFRunLoopRun + 1364
29  CoreFoundation                  0x351cc49e CFRunLoopRunSpecific + 294
30  CoreFoundation                  0x351cc366 CFRunLoopRunInMode + 98
31  UIKit                           0x322c5a0c -[UIApplication _run] + 544
32  UIKit                           0x322c2e76 UIApplicationMain + 1074
33  myApp                           0x000033a8 main (main.m:27)
34  myApp                           0x00003360 0x1000 + 9056

...and here the lines thrown on the console:

2012-05-16 10:52:26.440 myApp[315:707] DDCache: mmap failed with error 12
2012-05-16 10:52:26.444 myApp[315:707] DataDetectorsCore: mmapping the cache file failed
2012-05-16 10:52:26.466 myApp[315:707] DDCache: mmap failed with error 12
2012-05-16 10:52:26.470 myApp[315:707] DataDetectorsCore: mmapping the cache file failed
2012-05-16 10:52:26.485 myApp[315:707] DDCache: mmap failed with error 12
2012-05-16 10:52:26.490 myApp[315:707] DataDetectorsCore: mmapping the cache file failed
2012-05-16 10:52:26.509 myApp[315:707] DDCache: mmap failed with error 12
2012-05-16 10:52:26.514 myApp[315:707] DataDetectorsCore: mmapping the cache file failed
2012-05-16 10:52:26.529 myApp[315:707] DDCache: mmap failed with error 12
2012-05-16 10:52:26.533 myApp[315:707] DataDetectorsCore: mmapping the cache file failed
2012-05-16 10:52:26.548 myApp[315:707] DDCache: mmap failed with error 12
[...]
(always the same two lines)

I have no clue of what to do now. The major part of the devices launched the app with no problems, another part of devices had the 'ate bad food' which disappeared after rebooting/closing some apps, and a few (by now, a customer's one and one of our devices) can't launch it even rebooting/closing apps.

As I said previously, there seems not to be the case of a iOS specific device/model nor iOS version. What's more weird is that Apple validated my app and they didn't reported any crash or bug. Well, in fact they did, they rejected the first binary I uploaded because I had no Info.plist, so it worked when debugging but it didn't when running it as a final app. That was fixed, but I let you know it just in case is related.

Any idea?

Thank you in advance!

PS: I'm not a native English speaker, so if there is something weird that you don't understand don't hesitate to ask and I'll try to explain it again with other words.

Community
  • 1
  • 1
Andrés
  • 37
  • 8
  • Your written English is better than that of many native speakers! Your question has already been answered here: http://stackoverflow.com/questions/1282491/i-get-error-0x8badf00d-in-iphone-app-and-is-not-the-usual-suspect – jlehr May 16 '12 at 13:36
  • Thank you to you two! I saw the question you are referring me to, but unfortunately it wasn't useful to my problem. But now I think I'm getting nearer of the solution thanks to robbash answer. Thank you anyway :) – Andrés May 16 '12 at 13:57

1 Answers1

2

A possible reason for differences could be the amount of data you're working with.

As you already stated, you should probably optimized your startup. You are loading telephone numbers, right? If this might take some time, try to start and display the PhoneViewController with an activity indicator or similar, then start a thread to asynchronous load the data and update the view when done.

robbash
  • 985
  • 10
  • 21
  • I thought all I had to optimize or change for the watchdog not to kill my app had to be inside the didFinishedLaunching:WithOptions:, but your answer made me suspect of that PhoneViewController. I've put some NSLogs here and there into the viewDidLoad: of PhoneViewController and it seems that it is being executed too, not only the code inside the didFinishedLaunching:WithOptions: of the AppDelegate. So, the problem must be there. The weird thing here is that those NSLogs appear twice as if this viewDidLoad were being called twice, but I have no clue why. Thank you very much! – Andrés May 16 '12 at 13:44