2

When an iOS app enters background, a snapshot of the last screen is taken and placed in the cache. How do I view this image to ensure that sensitive information from the app is not accidentally stored in the cache?

I checked XCode organizer but I cant find a tool to open and view the cache.

Any ideas?

Thanks

rams
  • 6,381
  • 8
  • 46
  • 65
  • You can [take screenshot programmatically](http://stackoverflow.com/questions/2200736/how-to-take-a-screenshot-programmatically) and check its content in `- (void)applicationWillResignActive:(UIApplication *)application` in AppDelegate. – Ben Lu Jan 28 '13 at 20:25

2 Answers2

3

Don't worry about viewing the image - just make sure you won't show any sensitive information.

The OS will trigger a call to your application delegate's (void)applicationDidEnterBackground:(UIApplication *)application method. Use that to hide any information you need to. Take a look at this answer to a post concerning HIPAA requirements for an iOS app - you can pop to your root view so the app will resume somewhere without sensitive information.

Community
  • 1
  • 1
thegrinner
  • 11,546
  • 5
  • 41
  • 64
  • 3
    I was able to confirm that screen shot is not capturing any sensitive information by running the app in the iPhone/iPad simulator and examining the png stored to ~/Users//Library/Application Support/iPhone Simulator/6.0/Applications//Library/Caches/Snapshots/ use open -a preview .png to view the snapshot – rams Jan 28 '13 at 21:00
2

For a handy way to get the simulator folder put a breakpoint somewhere in code, then in Xcode debugger:

po NSHomeDirectory()

In Terminal ->

cd <pathfromabove>/Library/Caches/Snapshots/<yourappid>

then

ls

to see all the snapshots.. and then as mentioned in comment below question..

open -a preview <whatevernameofsnapshot>
Jess
  • 1,394
  • 12
  • 12