Hello iOS aficionados,
I’ve got my app working on iOS now, almost. There’s one feature that I haven’t figured out how to port over from the Android world to the iOS world.
I want to copy a hi-resolution jpg file from the temporary folder to some other location on the user’s device, where the user can access it. In the Android version of my app, I use the externalStorage plugin (from Scotth) to do the trick. In iOS, I thought it might be a good idea to use the Activity popup and copy to the “CameraRoll.”
My test device is an iPhone SE with iOS version 12.1.4. When the popup appears, it doesn’t mention Camera Roll but it does have save to “photos.” Unfortunately, that activity transforms the file in a way I hadn’t expected. The file I’m testing with is a photo of a mountain, in jpg format, about 8 MB in size, and 4048 by 2699 pixels. The file that appears in photos after the copy is a png, about 170 KB in size. It has 4048 by 2699 pixels, but all of them are the same color, gray. I see that the doc says “this will be converted to a UIImage” so perhaps the UIImage is the problem.
I’ve included some code below, but I think I might need a different approach all together. I’m not wedded to the Camera Roll idea. Any place that the user can access the high res file, say to print it or display it on a big screen monitor, would be good.
Any thoughts?
Dan
-- bring up native popup if ( native.canShowPopup( "activity" , "UIActivityTypeSaveToCameraRoll" ) ) then -- set up the copy local imageItems = { { type = "image", value = { filename = HiResFileToGet, baseDir = system.TemporaryDirectory } }, } local options = { items=imageItems, listener=popupListener } -- call the popup, with the options above, to do the copy native.showPopup( "activity", options ) else -- punt??? print("system error: can't show CameraRoll popup") end