sgr-ksmt / PDFGenerator

A simple generator of PDF written in Swift.
MIT License
757 stars 110 forks source link

Save permission #71

Open aliakkawi opened 7 years ago

aliakkawi commented 7 years ago

Hi, When running the app on a real deice i am getting this error: "Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “sample1.pdf” in the folder “51DBCB3B-3BA1-4CB9-91BE-0BE752979F51”." "

How can i solve the issue Thanks.

khetaram commented 7 years ago

Create file path in this way: NSArray paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString documentsDirectory = [paths objectAtIndex:0];

    //make a file name to write the data to using the documents directory:
    NSString *fileName = [NSString stringWithFormat:@"%@/textfile.txt",