ios - iPhone 4S - UnAuthorized Access Exception -



ios - iPhone 4S - UnAuthorized Access Exception -

this question sure xcode developers answer. have screenshot of code below in xamarin.

why getting unauthorized access exception? should able write documents folder right?

var webclient = new webclient(); //var documentsfolder = environment.getfolderpath (environment.specialfolder.personal); // ios 7 , before var documentsfolder = nsbundle.mainbundle.bundlepath; var filenameandpath = path.combine (documentsfolder, "verses.xml"); if(!file.exists(documentsfolder)){ directory.createdirectory(documentsfolder); if(!file.exists(filenameandpath)){ //file.setattributes(filenameandpath, fileattributes.normal); file.create(filenameandpath); //throws exception here. } }

and errors:

access path "/var/mobile/applications/1f95d694-bba5-4fb3-ae6c-0c2cdd9dedd8/comexample.app/verses.xml" denied

access path '/private/var/mobile/applications/1f95d694-bba5-4fb3-ae6c-0c2cdd9dedd8/documents/verses.xml' denied.

i have tried both paths , access denied.

assuming you're on ios 8, documents directory isn't connected bundle path. utilize function nssearchpathfordirectoriesindomains() (or urlsfordirectory:indomains:) find documents directory.

ios iphone xcode xamarin

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -