cocoa - make two different fetch request per one method - looks like impossible -


dear community. find trouble using core data. here description: appdelegate called own class:

initupdateixc *initandupdate = [[[initupdateixc alloc] init] autorelease]; [initandupdate updatecarrierlist:self.managedobjectcontext]; 

then using there couple of methods, update managedobjectcontext, insert, add entities e.t.c.

in case find limitation using predicate twice per method: first using working fine, , seen results inside request:

nsfetchrequest *requestdestinationsforsale = [[nsfetchrequest alloc] init]; [requestdestinationsforsale setentity:[nsentitydescription entityforname:@"destinationslistforsale"                                inmanagedobjectcontext:managedobjectcontext]];  [requestdestinationsforsale setpredicate:[nspredicate predicatewithformat:@"carrier.name %@",carriername]];  nsarray *destinationsforsale = [managedobjectcontext executefetchrequest:requestdestinationsforsale error:&error]; 

inside loop around mo:

for (nsmanagedobject *destinationforsale in destinationsforsale) {     (nsmanagedobject *code in [destinationforsale valueforkey:@"codesvsdestinationslist"])     { 

i try make new fetchrequest:

nsfetchrequest *requestdestinationwebuy = [[[nsfetchrequest alloc] init] autorelease]; [requestdestinationwebuy setentity:[nsentitydescription entityforname:@"destinationslistwebuy"                                             inmanagedobjectcontext:managedobjectcontext]]; nserror *error = nil;  [requestdestinationwebuy setpredicate:[nspredicate predicatewithformat:@"carrier.name %@",carriername]]; nsarray *destinationwebuylist = [managedobjectcontext executefetchrequest:requestdestinationwebuy error:&error]; 

ops... nsarray empty... if same when call method appdelegate: [initandupdate updateroutingtable:self.managedobjectcontext];

it's same class, same method, called main appdelegate , little bit changed using managed context, working fine.

looks managedobjectcontext have final updates when leave class methods, make updates. comment appreciated.

in first fetch fetching on entity destinationslistforsale in second fetching on entity destinationslistwebuy. simplest explanation same predicate not produce same result when applied different entities.

depending on specifics of both entities , data being persistent @ 1 time, same predicate produce different outcomes when applied against different entities.

indeed, expected behavior.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -