Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to create Directory outside the sandbox for THEOS Tweak
    primarykey
    data
    text
    <p>I'm making an iPhone tweak using THEOS which hooks to Google Chrome App. Part of the tweak functions, is to handle downloading and saving files using ASIHTTPRequest/ASINetworkQueue. The user can choose and set the download destination freely. This works fine as long as I set the download path to "/tmp" or Google Chrome Documents Folder. When I try to choose a folder other then these, like for instance "/var/mobile/Documents/" I get no permission error:</p> <blockquote> <p>Domain=NSCocoaErrorDomain Code=513 "The operation couldn’t be completed. (Cocoa error 513.)" UserInfo=0x1f53e230 {NSFilePath=/var/mobile/Documents, NSUnderlyingError=0x1f53b3d0 "The operation couldn’t be completed. Operation not permitted</p> </blockquote> <p>I've looked up this error and tried every other answer suggested here on StackExchange but to no avail.</p> <p>I'm developing for IOS 6 and I'm including the answers I've read here as links in case you guys think I missed out something:</p> <p>1 - <a href="https://stackoverflow.com/questions/8030054/how-to-make-a-directory-ios">How to make a directory iOS?</a></p> <p>2 - <a href="https://stackoverflow.com/questions/10281618/iphone-create-folder-outside-sandbox">iphone create folder outside sandbox</a></p> <p>3 - <a href="https://stackoverflow.com/questions/9065585/cydia-app-documents-folder-not-created">Cydia App Documents Folder Not Created</a></p> <p>4 - <a href="https://stackoverflow.com/questions/7841344/error-permission-denied-when-accessing-ios-filesystem-jailbreak">Gaining root permissions on iOS for NSFileManager (Jailbreak)</a></p> <p>The last link refers to running the app as root to access non mobile directories but not sure if this is appropriate since I'm only making a tweak for Chrome.</p> <p>I hope someone could help me with this issue or point me in the right direction. I'm tearing my hair out.</p> <p>Here's a common code snippet for creating a directory which just doesn't work for me:</p> <pre><code>NSString* SaveDir = @"/var/mobile/Documents/Test"; NSFileManager* fileManager = [NSFileManager defaultManager]; NSMutableDictionary* attributes = [[NSMutableDictionary alloc] init]; NSNumber* permission = [NSNumber numberWithLong: 0755]; [attributes setObject:permission forKey: NSFilePosixPermissions]; NSError* error = nil; if (![fileManager createDirectoryAtPath: SaveDir withIntermediateDirectories: YES attributes: attributes error: &amp;error]) { NSLog(@"Unable to create data directory: %@", error); } [attributes release]; </code></pre> <p>Thank you guys in advance</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload