0

I am developing a banking application and the client requirement is not to show/save the screen snapshot when app goes in the background (i.e., when home button is clicked). I have added an overlay view in background method and removed that view when app again comes in the foreground. Its working perfectly fine when I click home button, wait for 1 or 2 secs and then again click home button twice.

My problem is: If I click home button once, wait for some milliseconds (just before the app icons visible)and then again click home button twice, then the screen snapshot is visible (in multitasker view).

When I analysed the issue, I came to know that my background delegate method doesn't get called in this scenario and hence, no overlay view is added in this case.

Steps to Reproduce:

  1. Add An overlay view (with while color, lets say) in appDidEnterBackground Method of your application.
  2. Add code for removing that overlay view in willEnterForeground Method.
  3. Now, run your application.
  4. Press Home button once.
  5. Just after pressing home button once (and just before your application icon is visible), click home button twice so that you are able to see the Multitasker view.
  6. Instead of your overlay view, you would be seeing the application screenshot there.

Expected Results: The While overlay view should have been added, and you should have seen that instead of app snapshot.

Actual Results: You are able to see the application screen shot in Multi tasker view

Version: iOS 7 and above

anshul
  • 846
  • 1
  • 14
  • 32

1 Answers1

0

I've created an app that does exactly what you want. I throw up the shield image view in applicationWillResignActive:

- (void)applicationWillResignActive:(UIApplication *)application {
     // ...
     self.shieldImageView = [[UIImageView alloc] initWithFrame:self.window.frame];
     self.shieldImageView.image = [UIImage imageNamed:@"shieldimage"];
     self.shieldImageView.contentMode = UIViewContentModeScaleAspectFit;
     [self.window addSubview:self.shieldImageView];
     // ...
}

and get rid of it in applicationDidBecomeActive:

- (void)applicationDidBecomeActive:(UIApplication *)application {
     // ...
     [self.shieldImageView removeFromSuperview];
     self.shieldImageView = nil;
     // ...
}
wcochran
  • 10,089
  • 6
  • 61
  • 69