ios - Assertion failure in -[AppDelegate copyDatabaseIfNeeded], -
my database working 1 hour before. every thing worked finem issues now.
assertion failure in -[appdelegate copydatabaseifneeded],
i checking on path database not copy. checked target membership of sqlite file.
- (nsstring *)getdbpath { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory , nsuserdomainmask, yes); nsstring *documentsdir = [paths objectatindex:0]; return [documentsdir stringbyappendingpathcomponent:@"boom.sqlite"]; } - (void) copydatabaseifneeded { //using nsfilemanager can perform many file system operations. nsfilemanager *filemanager = [nsfilemanager defaultmanager]; nserror *error; nsstring *dbpath = [self getdbpath]; nslog(@"%@",dbpath); bool success = [filemanager fileexistsatpath:dbpath]; if(!success) { nsstring *defaultdbpath = [[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:@"boom.sqlite"]; success = [filemanager copyitematpath:defaultdbpath topath:dbpath error:&error]; if (!success) nsassert1(0, @"failed create writable database file message '%@'.", [error localizeddescription]); } }
but error:
*** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'failed create writable database file message 'the operation couldn’t completed. (cocoa error 260.)'.' *** first throw call stack: ( 0 corefoundation 0x000000010494b3f5 __exceptionpreprocess + 165 1 libobjc.a.dylib 0x00000001045e4bb7 objc_exception_throw + 45 2 corefoundation 0x000000010494b25a +[nsexception raise:format:arguments:] + 106 3 foundation 0x000000010420228f -[nsassertionhandler handlefailureinmethod:object:file:linenumber:description:] + 195 4 boomagift 0x000000010286dce7 -[appdelegate copydatabaseifneeded] + 663 5 boomagift 0x000000010286d8c0 -[appdelegate application:didfinishlaunchingwithoptions:] + 800 6 uikit 0x0000000102a825a5 -[uiapplication _handledelegatecallbackswithoptions:issuspended:restorestate:] + 234 7 uikit 0x0000000102a830ec -[uiapplication _callinitializationdelegatesformainscene:transitioncontext:] + 2463 8 uikit 0x0000000102a85e5c -[uiapplication _runwithmainscene:transitioncontext:completion:] + 1350 9 uikit 0x0000000102a84d22 -[uiapplication workspacedidendtransaction:] + 179 10 frontboardservices 0x00000001059aa2a3 __31-[fbsserialqueue performasync:]_block_invoke + 16 11 corefoundation 0x0000000104880abc __cfrunloop_is_calling_out_to_a_block__ + 12 12 corefoundation 0x0000000104876805 __cfrunloopdoblocks + 341 13 corefoundation 0x00000001048765c5 __cfrunlooprun + 2389 14 corefoundation 0x0000000104875a06 cfrunlooprunspecific + 470 15 uikit 0x0000000102a84799 -[uiapplication _run] + 413 16 uikit 0x0000000102a87550 uiapplicationmain + 1282 17 boomagift 0x000000010289fd53 main + 115 18 libdyld.dylib 0x00000001053cf145 start + 1 19 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating uncaught exception of type nsexception
Comments
Post a Comment