Ios development: saved file not showing on itunes

When I saved the PDF file to a file using the URL, the saved pdf file does not appear in the document window of iTunes / My iPad / Apps / MyApp. In fact, I don’t even see my application in the "File Sharing" section. How to do this, for example, like "dropbox" or "pages"?

Used code
// url pdf I want
NSURL *pdfURL = [NSURL URLWithString:@"http://manuals.info.apple.com/en/iphone_user_guide.pdf"];

// Get the path to our document directory
NSArray *documentPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

// This should be our document directory
NSString *saveDirectory = [documentPath objectAtIndex:0];
NSString *saveDirectory2 = [[saveDirectory stringByAppendingPathComponent:@"myfile.pdf"] retain];

// convert PDF to NSData, maybe I can’t convert from PDF?
NSData *dataToWrite = [NSData dataWithContentsOfURL:pdfURL];

// write pdf converted to memory along the way
BOOL status = [dataToWrite writeToFile:saveDirectory2 atomically:YES];

+3
source share
2 answers

Xcode :

1. Select your project in top left
2. Select target in next column
3. Click on Info tab
4. In Custom iOS Target Properties, hover mouse over any row and click +
5. In popup, select "Application supports iTunes file sharing", then set Value to YES on right
6. Click Validate Settings at bottom to make sure all is good
0

Source: https://habr.com/ru/post/1773279/


All Articles