Crash on creating new persistence store (jailbroken iPhone device 4.1)

0

Whenever I deploy "CoreDataBooks" Apple iOS sample application to my jailbroken device with self signed certificate and run it - it crashes at line where core-data persistent store is added to persistent store coordinator:

line 178:

if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&error]) {

// Update to handle the error appropriately. NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); }

It is also interesting that application's "Document" directory was never created and sqlite was never copied into it, so I'm suspected that it might be connected to write permissions issue. However, I've tested app by setting 777 permissions recursively and it was the same.

Sample works fine with iPhone Simulator.

Environment summary:

  • Xcode 3.2.4 / iOS SDK 4.1
  • Device: iPhone4 (iPhone3,1)
  • Firmware: 4.1 (8B117)
  • Jailbroken with: PwnageTool 4.1.2

Self signed certificate for code signing was used as described at http://ihackmyi.com/forum/index.php/topic,24020.0.html

Complete code was downloaded from this location: http: //developer.apple.com/library/ios/#samplecode/CoreDataBooks/Introduction/Intro.html

For building purpose, sample configuration was slightly changed:

  1. Base SDK: iOS Device 4.1
  2. Code Signing/Any iPhone OS Device: "Xcode Code Sign"
  3. iOS Deployment Target: iOS 4.1

I used SSH to deploy it to /Applications directory on the device and set permissions to 777 with:

iPhone:~ root# chmod -R 777 /Applications/CoreDataBooks.app

I used Respring to restart Springboard and after that I run CoreDataBooks app and it crashed with following crash log (I provided symbilized version):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <key>AutoSubmitted</key>
 <true/>
 <key>SysInfoCrashReporterKey</key>
 <string>a2191deea05fc5a80608f23ca9d8a375f4e0dc82</string>
 <key>bug_type</key>
 <string>109</string>
 <key>description</key>
 <string>Incident Identifier: CC4CFD7A-F2F3-4882-BC5E-54718D60BD90
CrashReporter Key:   a2191deea05fc5a80608f23ca9d8a375f4e0dc82
Hardware Model:      iPhone3,1
Process:         CoreDataBooks [681]
Path:            /Applications/CoreDataBooks.app/CoreDataBooks
Identifier:      CoreDataBooks
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2010-10-27 14:57:34.024 +0200
OS Version:      iPhone OS 4.1 (8B117)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Thread 0 Crashed:
0   libSystem.B.dylib              0x00078ac8 __kill + 8
1   libSystem.B.dylib              0x00078ab8 kill + 4
2   libSystem.B.dylib              0x00078aaa raise + 10
3   libSystem.B.dylib              0x0008d03a abort + 50
4   CoreDataBooks                  0x00006242 -[CoreDataBooksAppDelegate persistentStoreCoordinator] (CoreDataBooksAppDelegate.m:178)
5   CoreDataBooks                  0x00005ef0 -[CoreDataBooksAppDelegate managedObjectContext] (CoreDataBooksAppDelegate.m:120)
6   CoreDataBooks                  0x00005ce0 -[CoreDataBooksAppDelegate applicationDidFinishLaunching:] (CoreDataBooksAppDelegate.m:65)
7   UIKit                          0x0000e4b6 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 826
8   UIKit                          0x000049e0 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 200
9   UIKit                          0x0005dfd6 -[UIApplication handleEvent:withNewEvent:] + 1390
10  UIKit                          0x0005d8fa -[UIApplication sendEvent:] + 38
11  UIKit                          0x0005d330 _UIApplicationHandleEvent + 5104
12  GraphicsServices               0x00005044 PurpleEventCallback + 660
13  CoreFoundation                 0x00034cdc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
14  CoreFoundation                 0x00034ca0 __CFRunLoopDoSource1 + 160
15  CoreFoundation                 0x00027566 __CFRunLoopRun + 514
16  CoreFoundation                 0x00027270 CFRunLoopRunSpecific + 224
17  CoreFoundation                 0x00027178 CFRunLoopRunInMode + 52
18  UIKit                          0x000040fc -[UIApplication _run] + 364
19  UIKit                          0x00002128 UIApplicationMain + 664
20  CoreDataBooks                  0x00002f90 main (main.m:52)
21  CoreDataBooks                  0x00002f44 start + 32

Thread 1:
0   libSystem.B.dylib              0x0002d330 kevent + 24
1   libSystem.B.dylib              0x000d6b6c _dispatch_mgr_invoke + 88
2   libSystem.B.dylib              0x000d65bc _dispatch_queue_invoke + 96
3   libSystem.B.dylib              0x000d675c _dispatch_worker_thread2 + 120
4   libSystem.B.dylib              0x0007a67a _pthread_wqthread + 258
5   libSystem.B.dylib              0x00073190 start_wqthread + 0

Thread 2:
0   libSystem.B.dylib              0x0007b19c __workq_kernreturn + 8
1   libSystem.B.dylib              0x0007a790 _pthread_wqthread + 536
2   libSystem.B.dylib              0x00073190 start_wqthread + 0

Thread 3:
0   libSystem.B.dylib              0x00000c98 mach_msg_trap + 20
1   libSystem.B.dylib              0x00002d64 mach_msg + 44
2   CoreFoundation                 0x00027c38 __CFRunLoopServiceMachPort + 88
3   CoreFoundation                 0x000274c2 __CFRunLoopRun + 350
4   CoreFoundation                 0x00027270 CFRunLoopRunSpecific + 224
5   CoreFoundation                 0x00027178 CFRunLoopRunInMode + 52
6   WebCore                        0x000024e2 RunWebThread(void*) + 362
7   libSystem.B.dylib              0x0007a27e _pthread_start + 242
8   libSystem.B.dylib              0x0006f2a8 thread_start + 0

Thread 0 crashed with ARM Thread State:
    r0: 0x00000000    r1: 0x00000000      r2: 0x00000001      r3: 0x3e0862b4
    r4: 0x00000006    r5: 0x00159270      r6: 0x31703801      r7: 0x2fffe584
    r8: 0x3e3063c8    r9: 0x355aa336     r10: 0x33028027     r11: 0x33028008
    ip: 0x00000025    sp: 0x2fffe584      lr: 0x30277abf      pc: 0x30277ac8
  cpsr: 0x00000010

Binary Images:
    0x1000 -     0x7fff +CoreDataBooks armv7  <f2c845d1e546f60fd0f58b8390c87892> /Applications/CoreDataBooks.app/CoreDataBooks
   0x11000 -    0x11fff +MobileSubstrate.dylib armv6  /Library/MobileSubstrate/MobileSubstrate.dylib
   0x39000 -    0x3afff +MobileLoader.dylib armv6  /Library/MobileSubstrate/MobileLoader.dylib
   0x3e000 -    0x3ffff  dns.so armv7  <240b8d3f07b4fcb234de598f8e67de1a> /usr/lib/info/dns.so
  0x382000 -   0x3a4fff +Activator.dylib arm  <688435a67edc753ddf0a6a83ecd3c1e4> /Library/MobileSubstrate/DynamicLibraries/Activator.dylib
0x2fe00000 - 0x2fe26fff  dyld armv7  <a11905c8ef7906bf4b8910fc551f9dbb> /usr/lib/dyld
0x3002b000 - 0x300ebfff  libobjc.A.dylib armv7  <49029949741e10f21b178b0a4b2df979> /usr/lib/libobjc.A.dylib
0x301ff000 - 0x3030cfff  libSystem.B.dylib armv7  <0792bef82e8cde31cb32d06e80262288> /usr/lib/libSystem.B.dylib
0x307a0000 - 0x307a1fff  CoreSurface armv7  <586f25579330ac060decd2df4cc05bd8> /System/Library/PrivateFrameworks/CoreSurface.framework/CoreSurface
0x307ef000 - 0x307f7fff  libkxld.dylib armv7  <e86dd3313cbef5a3a0fb8598f6b0ab18> /usr/lib/system/libkxld.dylib
0x307f8000 - 0x308cbfff  CoreFoundation armv7  <adb562d8b5eaadbb874e255a09d0e04b> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x30996000 - 0x30a7efff  libGLProgrammability.dylib armv7  <ef656cb58e56a36789ee17d4d925e9ba> /System/Library/Frameworks/OpenGLES.framework/libGLProgrammability.dylib
0x30a7f000 - 0x30a87fff  libgcc_s.1.dylib armv7  <6fb15d72d3ee5444d901dc9ef974a3b3> /usr/lib/libgcc_s.1.dylib
0x30a88000 - 0x30ac2fff  IOKit armv7  <6810c1b44dd12227780dc88c76b692e4> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x30ac9000 - 0x30ad0fff  libbz2.1.0.dylib armv7  <0011bd5af0230fcaf63005f7eefa11dd> /usr/lib/libbz2.1.0.dylib
0x30ad5000 - 0x30ad7fff  MobileInstallation armv7  <8b23f794f02c2f7572a8fe6532630161> /System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation
0x30bb3000 - 0x30bbffff  SpringBoardServices armv7  <b715ca60b9e99b3b2b4f8270c478c138> /System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices
0x30bc8000 - 0x30c59fff  ImageIO armv7  <3f421780e67f0219e416287d3e684b54> /System/Library/Frameworks/ImageIO.framework/ImageIO
0x30cfb000 - 0x30d2afff  SystemConfiguration armv7  <b79a5a4f0506ce17bedeef7799e81687> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
0x30f4b000 - 0x30f82fff  Security armv7  <4770002d4b443c186dc1e3ddaa1787c8> /System/Library/Frameworks/Security.framework/Security
0x30f8b000 - 0x30fbbfff  AppSupport armv7  <20908678e860c23207574337097b94f1> /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport
0x313a6000 - 0x313a8fff  IOMobileFramebuffer armv7  <ef3a36680985b4db12a778d62f37961f> /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer
0x31499000 - 0x314a4fff  libz.1.dylib armv7  <19a78978d5908bedc6496470fe542936> /usr/lib/libz.1.dylib
0x31509000 - 0x31537fff  libCGFreetype.A.dylib armv7  <41663f59614034ba151e9b4f86e1e141> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib
0x31565000 - 0x31572fff  OpenGLES armv7  <6bdd1b930c09cfec7c6c7629551c0cbd> /System/Library/Frameworks/OpenGLES.framework/OpenGLES
0x315ec000 - 0x31601fff  libresolv.9.dylib armv7  <1ed920d5a995cd94e71c41631d7c551e> /usr/lib/libresolv.9.dylib
0x31619000 - 0x3171dfff  CoreData armv7  <36b5f42fcdceea61bedb2838f8279714> /System/Library/Frameworks/CoreData.framework/CoreData
0x318c3000 - 0x3196afff  WebKit armv7  <a8bfa45e5c19efcf95e184e658d61a18> /System/Library/PrivateFrameworks/WebKit.framework/WebKit
0x31adb000 - 0x31ae4fff  CoreVideo armv7  <d47b741a05fdbed287a454e834aeede2> /System/Library/Frameworks/CoreVideo.framework/CoreVideo
0x31c20000 - 0x31c20fff  vecLib armv7  <e1d93756e63104d2861a277e8a70df44> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/vecLib
0x31c88000 - 0x31c8efff  liblockdown.dylib armv7  <e89050debe57ae71a3f0ed2bc9c46145> /usr/lib/liblockdown.dylib
0x31e40000 - 0x31e4cfff  GraphicsServices armv7  <7075593b53fcd90c8d2aa40ba9ff4397> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x31e4d000 - 0x3308dfff  UIKit armv7  <3f1f8f7555dcf93cc4ce2146286bd3f6> /System/Library/Frameworks/UIKit.framework/UIKit
0x330af000 - 0x33601fff  WebCore armv7  <4d60fdc638b6218c26d3c143af5e829c> /System/Library/PrivateFrameworks/WebCore.framework/WebCore
0x337dd000 - 0x337fcfff  Bom armv7  <f49558f211241498f37af577051611b3> /System/Library/PrivateFrameworks/Bom.framework/Bom
0x33847000 - 0x33876fff  CoreText armv7  <0855144a7f9eeade285f2e7c030f7478> /System/Library/Frameworks/CoreText.framework/CoreText
0x3390e000 - 0x33951fff  CoreTelephony armv7  <deafb4c98c723215e43f07c3bf6d77e9> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
0x3396a000 - 0x3399dfff  AddressBook armv7  <59286907142fc76ead3dab9fa3baff5c> /System/Library/Frameworks/AddressBook.framework/AddressBook
0x3399e000 - 0x339b6fff  libRIP.A.dylib armv7  <6d9b86e946a18416f1a50586beabd716> /System/Library/Frameworks/CoreGraphics.framework/Resources/libRIP.A.dylib
0x339c7000 - 0x339cafff  libGFXShared.dylib armv7  <0d33b320dcac6cb6a594171f3f8c3b04> /System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib
0x339ea000 - 0x33a93fff  QuartzCore armv7  <1628da07ea69b89c0b6a5a7d2dc42a24> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x33b8b000 - 0x33bd0fff  libsqlite3.dylib armv7  <7de3ef8f02a0af58ef9f58348d5dbc50> /usr/lib/libsqlite3.dylib
0x33bfc000 - 0x33d17fff  CoreGraphics armv7  <6dcc299d5ca75f73afbc98a1b4bd2c7a> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x33d21000 - 0x33d8ffff  ProofReader armv7  <184b846e1f602485068db7a9c943595f> /System/Library/PrivateFrameworks/ProofReader.framework/ProofReader
0x33f5a000 - 0x33f99fff  libGLImage.dylib armv7  <f261ea6e5f00e4ba4fda02bb4d7712b4> /System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib
0x33fde000 - 0x34087fff  libxml2.2.dylib armv7  <1d74fa3a5cec309857503a51cb2df667> /usr/lib/libxml2.2.dylib
0x34091000 - 0x340dbfff  libstdc++.6.dylib armv7  <7b2a8cf02f12c636c6db7f5e1906f9f0> /usr/lib/libstdc++.6.dylib
0x340fc000 - 0x34396fff  libLAPACK.dylib armv7  <795a79616d24a733fae53d9df6c46998> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLAPACK.dylib
0x34464000 - 0x34503fff  JavaScriptCore armv7  <28583b202a5108a6e93c9990a2f1d576> /System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore
0x34569000 - 0x345befff  libvDSP.dylib armv7  <ec6199ca9490baba91f9bc644063bef1> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvDSP.dylib
0x3473e000 - 0x34740fff  libAccessibility.dylib armv7  <ee5bb3b14b91bcf192f0d18e9f31c40a> /usr/lib/libAccessibility.dylib
0x34781000 - 0x34786fff  MobileKeyBag armv7  <dabd32c6bac583a6809c2b04c5907acf> /System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag
0x34787000 - 0x348b7fff  AudioToolbox armv7  <9420239a007f28f7aa2163b05053d110> /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox
0x348ba000 - 0x348fafff  CoreAudio armv7  <96e6c0b793449c9e08a507693c956aad> /System/Library/Frameworks/CoreAudio.framework/CoreAudio
0x34906000 - 0x34951fff  libBLAS.dylib armv7  <9e5eadf1538d47142a4257d2fa5bbdd5> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libBLAS.dylib
0x34979000 - 0x3497cfff  IOSurface armv7  <83927fd3641791e5bcdadcca0edd196b> /System/Library/PrivateFrameworks/IOSurface.framework/IOSurface
0x349a7000 - 0x34ac6fff  Foundation armv7  <5cffb5458e87beccdb75770cea676753> /System/Library/Frameworks/Foundation.framework/Foundation
0x34ad8000 - 0x34ae5fff  libbsm.0.dylib armv7  <df1574298fea28ad799e1549425b44a4> /usr/lib/libbsm.0.dylib
0x34b3c000 - 0x34c55fff  libicucore.A.dylib armv7  <71ef015f1994cf85658df91a50a37815> /usr/lib/libicucore.A.dylib
0x34c56000 - 0x34c56fff  Accelerate armv7  <0601858b149ba0586210ad15b0d41c1e> /System/Library/Frameworks/Accelerate.framework/Accelerate
0x34cdf000 - 0x34da1fff  CFNetwork armv7  <0860d900e5328f349290feaaa3eb6e9a> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x35122000 - 0x3514bfff  MobileCoreServices armv7  <fe6ab911eb680b758f415e20afec8e00> /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices
</string>
 <key>displayName</key>
 <string>CoreDataBooks</string>
 <key>name</key>
 <string>CoreDataBooks</string>
 <key>os_version</key>
 <string>iPhone OS 4.1 (8B117)</string>
 <key>system_ID</key>
 <string></string>
 <key>version</key>
 <string>??? (???)</string>
</dict>
</plist>

It is the same with other core-data related samples.

Thanks in advance, Nikola

iphone
xcode
core-data
jailbreak
self-signed
asked on Stack Overflow Oct 27, 2010 by user488584

1 Answer

2

Just a guess, but try to create the documents directory manually. It crashes because of the abort(); which gets called when the persistent store could not be accessed. And it can't be accessed (i.e. created) if the directory is not there.

I think the documents directory is created upon regular install of the app.


Or try adding this somewhere at the beginning:

NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
[[NSFileManager defaultManager] createDirectoryAtPath:path attributes:0];
answered on Stack Overflow Oct 27, 2010 by Matthias Bauch

User contributions licensed under CC BY-SA 3.0