I am not sure that Apple allows this kind of stuff. I just want to make an application to take a screen capture whatever app is open on the iPhone not only the current application. Please suggest any solutions.
-
You can capture the things which are on a `UIView` but you can't capture which are on a `UIWindow`. For ex: If you have a `UIAlertView` presented, that won't be captured but other subviews of UIView will be – Rajan Maheshwari Jul 28 '16 at 06:09
-
that means i can capture the things which on my application screen. except i can not do any thing on My UIWindow of iphone. – kalpesh Jul 28 '16 at 06:12
-
You cant capture Navigation Bar and all elements which are presented on UIWindow like AlertView, ActionSheet etc. – Rajan Maheshwari Jul 28 '16 at 06:13
-
Also you can't capture any other app's screen – Rajan Maheshwari Jul 28 '16 at 06:15
-
Ya Thanx dear Rajan. – kalpesh Jul 28 '16 at 06:16
4 Answers
No, afraid not. Due to sandboxing, you only have access to your own app's window.

- 155
- 1
- 7
You can't capture screen of another applications or windows rather then your application. It's restricted by apple.
You can capture your application's screen by using UIGraphicsBeginImageContextWithOptions
. for that you can refer this so post.

- 1
- 1

- 27,092
- 9
- 50
- 75
-
We can't capture any objects that are on UIWindow like `UIAlertView` or you can say `UIAlertController` – Rajan Maheshwari Jul 28 '16 at 06:14
-
@RajanMaheshwari : Yeah!! right, i have already mentioned that in answer! – Ketan Parmar Jul 28 '16 at 06:57
You can find all information about background tasks here: https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html But I don't think, that Apple will allow you to take screenshots of other apps, as it could lead to security problems.

- 106
- 6
You can't capture other applications screen except your own application. Here is the code to take screen shot of the view
class Welcome: UIViewController {
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, [UIScreen mainScreen].scale);
else
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(image, self, nil, nil);
}

- 13,794
- 9
- 55
- 77

- 11
- 3