Getting an image from simulator to the Mac?

I managed to build an iOS Screen Recorder that captures the looks of any view with 60 fps. Despite the image extraction taking some time and problems with making the conversion run on a thread, it generally runs very well and I can create an animated UIImage at the end that can be saved to Simulator’s photo album.
Now I cannot bend my head around how to get this image from the simulator to my development Mac. I don’t want to use the social media sharing, and the iCloud photo album from simulator doesn’t want to appear on my Mac.
Any ideas? Possible at all?

I don’t have my computer right now to say exactly where but there is a path where the entire contents of the simulator are stored that you can access to retrieve the associated data. Look in /Library/Developer/Xcode maybe? You should see the simulator name with its unique ID as one of the folder names.

Edit: try displaying SpecialFolder.Documents.Path to see if it gives the full path, this might be the easiest method.

The iOS simulator do have a very long paths where their containers are but they are just files on your Mac
You should be able to show that path and then navigate to it

just for debugging, or for a release app?

There is a setting that allows apps to share their documents through iTunes.
Users open iTunes, select the app, and get a view of the documents for that app, where they can copy from or to.

I would expect the simulator to simulate this in a folder in the Library/ of your mac, but in a hidden folder you may take a while to track down…

When I was using Corona, these lived in Library/Application Support/Corona Simulator//documents

I haven’t used Xojo for mobile, so can’t speak with certainty for where the simulation occurs for that…

(edit)… What Norm said… :wink:

Path are long and complicated.
Use system.debuglog to show the path

Thanks a lot, you all! I’ll search the path tomorrow.

To answer Jeff’s question: Just for debugging, or rather for documenting. I found the screen record solutions on Mac either don’t support animated images or if they are not very comfortable or too slow to catch a fast animation – let alone simulator display may not always reflect the current state of views –, and I had the idea that catching the image of the views themselves might be much better. On a real device, sending the image via E-Mail should be no problem, although I am not sure how iOS handles an animated UIImage when sending it via mail.

You ought to try the screen recording directly from a device through QuickTime Player. That seems to capture everything here.

Thanks, Greg. Recording UIVIews wasn’t the problem, that runs nicely, fast and with amazingly low CPU impact. And I can attach a recorder to every single UIView, not only the UIWindow or iOSView, which is very nice for detail captures, and don’t have to care if it is moved on its parent. Getting the result from Simulator to the Mac was difficult.
But looks good now, although I’ll probably do the next recording with a not that comfortable, but working OS X animated GIF-capture device. I’d prefer animated pngs but will keep that for later. I heard there’s a quiet week ahead …

[quote=236819:@Ulrich Bogun]Thanks, Greg. Recording UIVIews wasn’t the problem, that runs nicely, fast and with amazingly low CPU impact. And I can attach a recorder to every single UIView, not only the UIWindow or iOSView, which is very nice for detail captures, and don’t have to care if it is moved on its parent. Getting the result from Simulator to the Mac was difficult.
But looks good now, although I’ll probably do the next recording with a not that comfortable, but working OS X animated GIF-capture device. I’d prefer animated pngs but will keep that for later. I heard there’s a quiet week ahead …[/quote]

QuickTime Player will record fill motion video - either full screen or just the selected area
Much nicer than a GIF :stuck_out_tongue:

No doubt! The reason I’m trying this is I want to enhance the iOSLib documentation. I can add images to the Wiki but cannot embed videos (or at least I didn’t find out how), and having to click external links isn’t as comfortable as seeing the result immediately. That’s the state of things with GiFs so far: https://github.com/UBogun/Xojo-iosLib/wiki/UIView-animations

https://www.mediawiki.org/wiki/Extension:EmbedVideo

You made my day, Norman!
Now that I don’t need it anymore: Anyone interested in how to capture images in 60 fps on iOS? :smiley:

[quote=236835:@Ulrich Bogun]You made my day, Norman!
Now that I don’t need it anymore: Anyone interested in how to capture images in 60 fps on iOS? :D[/quote]

If you could do a point by point description that would be superb :slight_smile: No need for anything fancy, just a list of pointers.

A bit problematic with pointers only because I built this upon iOSLib classes of course. But you will surely find the descriptions:

I created a ScreenRecorder which attaches itself to a UIView together with a fps rate in its constructor.
Taking 1000/fpsRate as a timer period, I have the timer run after the recorder.start method was called with

Screenshots.Append mRecordView.Snapshot()

with Screenshots being a Xojo array of UIViews,
mRecordView the UIView the recorder is attached to and the code of snapshot being a AppleView (UIView) method:

Declare function snapshotViewAfterScreenUpdates lib UIKitLibname selector "snapshotViewAfterScreenUpdates:" (id as ptr, afterupdate as boolean) as ptr dim result as new AppleView (snapshotViewAfterScreenUpdates (id, afterUpdates)) result.Retain Return result
It is important to retain the view, else it will vanish.

That’s fast enough to capture in realtime. The UIViews are stored as UIViews, which means you have to extract their images in a way like

for q as integer = 0 to Screenshots.Ubound images.Append Screenshots(q).toImage.toiOSImage next

Where images is just a Xojo array of iOSImages and the AppleView.toImage method is like

AppleCGContext.BeginImageContext (me.Bounds.Size_, false) dim context as AppleCGContext = AppleCGContext.CurrentContext dim success as boolean = DrawViewHierarchy(me.bounds, true) dim img as AppleImage if success then img = Context.toImage AppleCGContext.EndImageContext return img

and to iOSImage the conversion between a UIImage and a Xojo iOSImage. This conversion is very CPU-intensive, expect to wait a few seconds for 120 screenshots = 2 seconds of 60 fps recording. That’s what I couldn’t push into a thread without rendering my GUI useless.
It’s a bit faster of course to only retrieve the UIImage instead of the iOSImage, which brings you the possibility to sample everything into one animated UIImage or to save single PNG or JPEG representations – maybe even an animated PNG; I haven’t tested that yet.

Writing the iOSImages with another timer into the picture property of an iOSImageView is fast enough to play back in realtime again.

Thank you, Ulrich. Will the screenshot recorder be part of iOSLib eventually ?

To be honest, having read the discussion about the low sales impact of 3rd party tools I was considering for a moment to offer it for like 5$. But it’s a very small tool with very limited use (again: See the thread problem), and I still do believe that contributions to the user community will pay back in one way or the other, so the answer is yes.
Once I am done with the animations section on the Wiki (there’s still the transitions waiting to be added), I will overwork my UIView subclasses and then upload a new version. ETA (ETF?) is between Xmas and New Year.

[quote=236880:@Ulrich Bogun]To be honest, having read the discussion about the low sales impact of 3rd party tools I was considering for a moment to offer it for like 5$. But it’s a very small tool with very limited use (again: See the thread problem), and I still do believe that contributions to the user community will pay back in one way or the other, so the answer is yes.
Once I am done with the animations section on the Wiki (there’s still the transitions waiting to be added), I will overwork my UIView subclasses and then upload a new version. ETA (ETF?) is between Xmas and New Year.[/quote]

Look at the price of equivalent tools. $5 is, well, largely underpriced…

http://www.macworld.com/article/2183924/how-to-capture-movies-of-your-ios-devices-screen.html what is listed here is $13 and$15.