ios - Run NSBundle from the documents folder -


is there way use nsbundle documents folder on ios?

not sure exact question is, either, here how access local document folder of app (this not documents folder store sources app uses, 1 app stores local resources) example, in app take pics camera , store them app's local folder, not device camera roll, number of images this, in viewwillappear method use:

// create route of localdocumentsfolder nsarray *filepaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); //first use local documents folder nsstring *docspath = [nsstring stringwithformat:@"%@/documents", nshomedirectory()]; //then use bundle, indicating path nsstring *bundleroot = [[nsbundle bundlewithpath:docspath] bundlepath]; //then content nsarray *dircontents = [[nsfilemanager defaultmanager] contentsofdirectoryatpath:bundleroot error:nil]; // counts total of jpg images contained in local document folder of app nsarray *onlyjpgs = [dircontents filteredarrayusingpredicate:[nspredicate predicatewithformat:@"self endswith '.jpg'"]]; // in console tell me how many jpg have nslog(@"numero de fotos en total: %i", [onlyjpgs count]); // --------------- 

if want know in documents folder (the 1 can browse in ios simulator

via ~/yourusername/library/application support/iphone simulator/versioofsimulator/applications/appfolder/documents)

you use nsstring *bundleroot = [[nsbundle mainbundle] bundlepath]; instead.

hope helps you, mate!


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -