objectiveccoder001
objectiveccoder001

Reputation: 3031

Save file opened with UIDocumentInteractionController

I have my app opening XML files and it reads them perfectly.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [launchOptions valueForKey:UIApplicationLaunchOptionsURLKey];
}

But, I'd like to save the document once it's opened, access the saved version, then be able to delete it later.

Any ideas on how to accomplish this?

Upvotes: 0

Views: 602

Answers (1)

rmaddy
rmaddy

Reputation: 318774

When your app is asked to handle a file, you should handle this in the UIApplicationDelegate application:openURL:sourceApplication:annotation: method. The URL will point to the file you are being asked to process.

To save this file, copy the file from the given URL to your app's Documents directory (or other desired app sandbox directory). Use the NSFileManager moveItemAtURL:toURL:error: method to move the file to the Documents directory.

Upvotes: 1

Related Questions