core data - "_Unwind_Resume" called upon dead simple fetch request -
i'm trying port on core data code on test mac os application iphone app. set helper method manage of code fetches, , works great on mac os, error on iphone:
detected attempt call symbol in system libraries not present on iphone: _unwind_resume called function -[nssqladapter _newselectstatementwithfetchrequest:ignoreinheritance:] in image coredata.
here code calls helper method:
// authors , title works nsarray *bookinfofetchresults = [self getentitiesbyname:koc_cd_objectkey_bookinfo usingpredicatevalue:@"contentroot.bookinfo.bookauthors > \"\"" withsubstitutionvariables:[nsdictionary dictionarywithobjectsandkeys:nil] inmodel:model andcontext:context sortbyattribute:nil]; int thisresult = 0; int lastresult = [bookinfofetchresults count]; (thisresult = 0; thisresult < lastresult; thisresult++) { nsmanagedobject *currentresult = [bookinfofetchresults objectatindex:thisresult]; nslog(@"bookauthors: %@", [currentresult valueforkey:koc_cd_objectattribute_bookauthors]); nslog(@"booktitle: %@", [currentresult valueforkey:koc_cd_objectattribute_booktitle]); } // chapters not work nsarray *chapterfetchresults = [self getentitiesbyname:koc_cd_objectkey_chapter usingpredicatevalue:@"all contentroot.chapters.title > \"\"" withsubstitutionvariables:[nsdictionary dictionarywithobjectsandkeys:nil] inmodel:model andcontext:context sortbyattribute:koc_cd_objectattribute_key]; int thischapterresult = 0; int lastchapterresult = [chapterfetchresults count]; (thischapterresult = 0; thischapterresult < lastchapterresult; thischapterresult++) { nsmanagedobject *currentchapterresult = [chapterfetchresults objectatindex:thischapterresult]; nslog(@"chapter %@: %@", [currentchapterresult valueforkey:koc_cd_objectattribute_number], [currentchapterresult valueforkey:koc_cd_objectattribute_title]); }
the helper method (stripped of error-checking, though removing didn't change resulting error):
- (nsarray *) getentitiesbyname:(nsstring *)entityname usingpredicatevalue:(nsstring *)predicatevalue withsubstitutionvariables:(nsdictionary *)variablesdict inmodel:(nsmanagedobjectmodel *)amodel andcontext:(nsmanagedobjectcontext *)acontext sortbyattribute:(nsstring *)sortingattribute; { nsarray *fetchresults; nsstring *fetchrequesttemplatename = [nsstring stringwithformat:@"get_%@", entityname]; nsfetchrequest *fetchrequesttemplate = [[nsfetchrequest alloc] init]; nsentitydescription *targetentitydescription; targetentitydescription = [[amodel entitiesbyname] objectforkey:entityname]; [fetchrequesttemplate setentity:targetentitydescription]; // need find way catch error here in case give isn't right // nsinvalidargumentexception: unable parse format string "mqaynh5bxs" nspredicate *predicatetemplate = [nspredicate predicatewithformat:predicatevalue]; [fetchrequesttemplate setpredicate:predicatetemplate]; [amodel setfetchrequesttemplate:fetchrequesttemplate forname:fetchrequesttemplatename]; [fetchrequesttemplate release]; if (variablesdict == nil) { variablesdict = [nsdictionary dictionarywithobjectsandkeys:nil]; [variablesdict retain]; } nsfetchrequest *fetchrequesttoexecute = [amodel fetchrequestfromtemplatewithname:fetchrequesttemplatename substitutionvariables:variablesdict]; nserror *fetcherror; fetchresults = [acontext executefetchrequest:fetchrequesttoexecute error:&fetcherror]; if ((sortingattribute != nil) && (fetchresults != nil)) { nssortdescriptor *attributesorter = [[nssortdescriptor alloc] initwithkey:sortingattribute ascending:yes]; fetchresults = [fetchresults sortedarrayusingdescriptors:[nsarray arraywithobject:attributesorter]]; [attributesorter release]; } return fetchresults; }
the point of failure in helper method is:
fetchresults = [acontext executefetchrequest:fetchrequesttoexecute error:&fetcherror];
breaking out code helper method doesn't work either.
i don't know if help, after stripping out error-handling code in helper method, this:
2010-11-30 16:31:30.633 oc flash card core 2[19306:207] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'unsupported predicate (null)' *** call stack @ first throw: ( 0 corefoundation 0x02655b99 __exceptionpreprocess + 185 1 libobjc.a.dylib 0x027a540e objc_exception_throw + 47 2 coredata 0x02381e86 -[nssqlgenerator generatesqlstatementforfetchrequest:ignoreinheritance:countonly:] + 1254 3 coredata 0x023816f0 -[nssqladapter _newselectstatementwithfetchrequest:ignoreinheritance:] + 480 4 coredata 0x02381501 -[nssqladapter newselectstatementwithfetchrequest:] + 49 5 coredata 0x023813ae -[nssqlcore newrowsforfetchplan:] + 430 6 coredata 0x02380b09 -[nssqlcore objectsforfetchrequest:incontext:] + 297 7 coredata 0x023806fe -[nssqlcore executerequest:withcontext:error:] + 206 8 coredata 0x0242e91c -[nspersistentstorecoordinator executerequest:withcontext:error:] + 1084 9 coredata 0x0237d897 -[nsmanagedobjectcontext executefetchrequest:error:] + 359 10 oc flash card core 2 0x0000360e -[occontentimporterobj getentitiesbyname:usingpredicatevalue:withsubstitutionvariables:inmodel:andcontext:sortbyattribute:] + 481 11 oc flash card core 2 0x00002af7 -[occontentimporterobj testcoredataintegrity] + 188 12 oc flash card core 2 0x00002864 -[occontentimporterobj importcontent] + 88 13 oc flash card core 2 0x0000252b -[appdelegate_iphone application:didfinishlaunchingwithoptions:] + 91 14 uikit 0x002b4f27 -[uiapplication _callinitializationdelegatesforurl:payload:suspended:] + 1163 15 uikit 0x002b73b0 -[uiapplication _runwithurl:payload:launchorientation:statusbarstyle:statusbarhidden:] + 346 16 uikit 0x002c13ec -[uiapplication handleevent:withnewevent:] + 1958 17 uikit 0x002b9b3c -[uiapplication sendevent:] + 71 18 uikit 0x002be9bf _uiapplicationhandleevent + 7672 19 graphicsservices 0x02f35822 purpleeventcallback + 1550 20 corefoundation 0x02636ff4 __cfrunloop_is_calling_out_to_a_source1_perform_function__ + 52 21 corefoundation 0x02597807 __cfrunloopdosource1 + 215 22 corefoundation 0x02594a93 __cfrunlooprun + 979 23 corefoundation 0x02594350 cfrunlooprunspecific + 208 24 corefoundation 0x02594271 cfrunloopruninmode + 97 25 uikit 0x002b6c6d -[uiapplication _run] + 625 26 uikit 0x002c2af2 uiapplicationmain + 1160 27 oc flash card core 2 0x00001ce0 main + 102 28 oc flash card core 2 0x00001c71 start + 53 ) terminate called after throwing instance of 'nsexception'
but, again, of worked flawlessly in mac os. i've tried searching _unwind_resume
seems bug on apple's part, , there @ least dozen different ways hit , dozen different ways resolve it. differential can think of 1 attempt has 1 instance in cd store (intentionally so) , second, trouble one, can have many. ideas?
figured out how around this: in predicate used search, all
keyword needs any
.
what don't understand why case. error given seems obscure, , fact ends exc_bad_access
troubling. i'm willing accept answer can explain why there such difference between any
, all
.
Comments
Post a Comment