path - iOS: NSBundle object becomes invalid after folder removed and recreated -


i using following initialise bundle object in viewdidload.

documentbundle = [[nsbundle alloc] initwithpath:path]; 

where path looks following;

/users/..../library/application support/iphone simulator/6.1/applications/b69b8a03-c029-4df5-89e0-1429e73e840f/documents/downloads/documents.bundle 

while application running need update documents.bundle , rid of old one. remove , download latest 1 web. have confirmed bundle object points same folder it's not able contents inside bundle after replaced existing folder. if restart application latest contents! not sure what's going on here. can 1 point out wrong?

following returns nil path after replaced bundle! can see required file right there terminal!

nsstring *path = [documentbundle pathforresource:filename oftype:extension]; 

i have tried reinitialise bundle object after replacing bundle still points same memory address (printed using %p) , doesn't return content new bundle.

i same result on both device , simulator.

it seems nsbundle remembers file system during instantiation of object. after doesn't recognise new files added folder! if remove folder , recreate new same name doesn't recognise either. tried nsbundle pointing documents directory , used [pathforresource:filename oftype:extension indirectory:directory] doesn't work when replace directory. in short never deal nsbundle if file system dynamic using same names!

i found solution creating current timestamp folder each new downloads , removing older folder , reset nsbundle object. works , creates right path wasn't exists! read apple documents on nsbundle more details.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -