objective c - save UIImage to disk with simulator ios 8 doesn't work -
the following code works great on ios < 8 doesn't work xcode 6.1.1 , ios 8 device simulator
nsdata *imagedata = uiimagepngrepresentation(sharesnapshot); [imagedata writetofile:@"/users/myuser/desktop/123.png" atomically:yes];
does know if simulator issue don't have real device ios8 check on.
so you're running permission issue here. i'm not sure why worked before 8.0, i'm seeing (something changed):
the operation couldn't completed. (cocoa error 513)
as stands, you'll run problems when running on actual device. better way handle save data application's document directory.
- fetch directory path via nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes)
- append filename using stringbyappendingpathcomponent
you can verify it's saving visiting simulators application directory:
- /users/user/library/developer/coresimulator/devices//documents/
Comments
Post a Comment