ios - How would I go about saving snaps (UIImage) to the sandbox? -


i'm creating theos tweak jailbroken iphone , i'm stuck on feature. far can block screenshot detection , replay detection, add infinite text, , have app open directly feed. feature i'm stuck on saving incoming , outgoing snaps (and stories, 1 step @ time). used flexible tweak cydia assist me , noticed snaps have "uiimage." know have somehow convert uiimage *.jpg or *.png , save somewhere (i'm looking save app's documents directory).

i searched around site , found following may helpful:

// convert uiimage jpeg nsdata *imgdata = uiimagejpegrepresentation(image, 1); // 1 compression quality  // identify home directory , file name     nsstring  *jpgpath = [nshomedirectory() stringbyappendingpathcomponent:@"documents/test.jpg"];   // write file.  choose yes atomically enforce or none write. use no flag if partially written files okay can occur in cases of corruption [imgdata writetofile:jpgpath atomically:yes];  

and

// create paths output images nsstring  *pngpath = [nshomedirectory() stringbyappendingpathcomponent:@"documents/test.png"]; nsstring  *jpgpath = [nshomedirectory() stringbyappendingpathcomponent:@"documents/test.jpg"];  // write uiimage jpeg minimum compression (best quality) // value 'image' must uiimage object // value '1.0' represents image compression quality value 0.0 1.0 [uiimagejpegrepresentation(image, 1.0) writetofile:jpgpath atomically:yes];  // write image png [uiimagepngrepresentation(image) writetofile:pngpath atomically:yes]; 

(like said found this; not code).

bah, i'm not sure how incorporate this. help?


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo