iOS7 Screen Capture Prevention / Detection - ios

In my iOS app I need either prevent the screenshot capture (by pressing combination of Home +Power button), or need to detect before it saved to the Photo library .
In previous iOS version before taking screenshot touchesCancelled:withEvent this method will called , but iOS7 onwards this wont work.
Apple provide a notification
UIApplicationUserDidTakeScreenshotNotification
for detecting screenshot capture .The real problem is this will fire only after the screenshot is saved in Photo library .
Is there any methods (Private /Public) for detecting screenshot before it happens , or Just prevent the screenshot feature .
Dont consider it as a duplicate question , it is iOS7 specific question

No, nothing has changed since iOS7 and it will not change in the future, it is a conceptual issue, iOS app doesn't has control over the device public functions, consider you turned off 'taking screenshot' while other application needs it!! How this app would know about that?
Best thing you can do is using Configuration Profile as mentioned #QED valid answer.

You can restrict with a Configuration Profile, as described in the linked question.
Check out the Restrictions Payload section, starting on page 27, of the iPhone Configuration Proifile Reference. The key you want is allowScreenShot, described at the bottom of page 30.
Also, the linked reference states that there are a number of ways to install a profile. It may be possible for you to provide, within the app, some method for the user to trigger your server to install/reinstall your profile. Just a thought, I'm not experienced in the matter.
I'm not able to speak to private APIs. You might check out http://www.modmyi.com, or snoop around on IRC for some jailbreak communities. There are lots of experts out there who may be able to point you to the API, but they don't tend to hang on SO.
Good luck!

Related

List of Apple devices using the home indicator?

I'm developing a mobile app and need to know whether or not a home indicator is present on the device I am on (in ios cases). I know that it exists on iPhone X and higher versions. But I can't find out an official list of devices implementing that new feature. Is there one?
That way, I could adapt my UI design according to wether or not the device I detect belongs to that list. (using com.diamonddevgroup.device.Device API)
Just in case, I'm developping using codenameone.
Thanks
I added support for handling that.
Once the update has been approved by Codename One team, update your Device library and call below:
boolean isNotch = Device.isNotch();
You can check the GitHub page for the library here.
And you can follow the status of the library update approval with this pull request. It is approved once its status has changed to Closed.
Leave a comment on this answer or create an issue here if you encounter any problem with the library.
You should definitely be using the safe areas with auto layout to properly layout your views.
But in the case you want to do device specific work, this library is fantastic for knowing about your user's current device.

IOS 12 Unwanted communication Reporting Extension Working on Phone but not on Messages app

I have been trying to make the new iOS extension Unwanted Communication Reporting work. Currently I couldn't find any good walk-through tutorial or code-sample to make it work. Above that by just firing up a new project with this extension and building it shows me the option of reporting in the Phone App but not on the Messages app, Moreover, the option to enable it only appears in phone app but it says "sms/phone" so I think this should work for both of them.
I know its in beta right now but just want to know if anyone had any luck with it. Also, There is no code to share as its just the boiler plate that comes with the new project.
This might have been a personal issue. I reset the whole phone and now I can see the options to report message. Apple might have fixed it in their latest iOS build or it might have just been my device issue.
Apple's developer site specifies ”SMS and call spam reporting," which is an app extension that you will have the option of turning on or off.
You may enable an Unwanted Communication extension in the Settings app. I am not sure if Apple will utilize this but i know for android - screen turns red when such spam calls come in, also caller id notes that but currently apple seems to have found a middle ground.
The following worked for me, you can try:
Remove command definition for this in Plist file.
Delete the Target in project (you can delete code folder).

Detect which app is in foreground on iOS9 without jailbreak

I'm trying to log users individual app usage on iOS9.
I'd rather prefer that it wouldn't use jailbreak limited solutions, self explanatory. Doing the variation of this app on a jailbroken phone shouldn't be hard.
This will certainly not be released on the App Store as Apple wouldn't allow it.
I'm looking for any private API that can do this, any hidden iOS API's that can be used to do this. ANYTHING.
What I've already looked through:
how to determine which apps are background and which app is foreground on iOS by application id
How to know about app launched and details jailbreak iOS 7
Is there a private API to be able to detect what is current foreground app on iOS?
How to monitoring App running in the foreground in iOS8?use the PrivateFrameworks SpringBoardServices
which proved to be relatively helpful - we now can assume that there is some sort of additional access requirement, probably an entitlement, but we don't really know how it should look like
Can you find individual app usage duration using SpringBoard services framework or other private framework?
Find out active application or if on Springboard
Programmatically detect which iOS application is visible to user
However all of these proved to be unhelpful because Apple fixed this security flaw with iOS8 and the method to copy/access the currently front most app bundle identifier no longer works.
Question is: Is there someone who knows a workaround using different tools/exploits that do not require jailbreak?
Ideas:
inspecting the processes running on the device and devising an algorithm that would be able to recognize spikes that mean an app has been launched, which potentially could work, but it probably would be a major pain in the ass. Questions mentioning this solution:
Detect which app is currently running on iOS using sysctl,
Return a list of running background apps/processes in iOS
How to get Names of Background Running Apps
Find Background running apps in iphone
inspecting the phones traffic somehow?
not sure if there is some kernel stuff that I could do
Here is my Reddit version of this question if anyone wants to check it out. Also if it's of any value, here are the runtime headers for iOS9 and list of Apple's private API's.
Unfortunately, I was looking for a similar solution and have come to the conclusion that, at least at this point in time, there are no known methods that will allow you to determine app usage on iOS. Even the MDM providers such as Good, Airwatch, MobileIron, etc. don't seem to be able to do this. If anyone is able to come up with a solution, I'd love to see it.
For now, however, I think we would have seen a solution if someone had one that worked on the latest iOS.
sysctl is still open but they block certain combinations of selectors. I did this on iOS 7 and gave Apple Product Security the code. They won't patch iOS 7 but rely on App Review. iPhone 4 is wide open.

Programmatically detect which iOS application is visible to user

I found this and the problem is that the answers on that question didn't pan out (I also tested them first) and also that it is over a year old.
I've used the solution here to fetch the list of all running processes, but not of the struct kinfo_proc attributes seem to give any useful in detecting which app is currently visible to the user.
Basically:
I am trying to find out which app is currently visible (and open) to the user on iOS devices.
It must work on stock devices (non-jailbroken) and no need to worry about the app store.
Edit: I am looking at the private APIs now, but cannot seem to determine how my app could be notified (or inquire) about a new application being brought to the front.
Thank you
Thanks to #JohnWoods in the comment section of the question, I was able to find the solution on a related question.
The solution I used and that worked for me was here.

Access private APIs on NON-jailbroken devices for Business use ONLY

This question follows the answer provided by Nate on this link:
How do I change my iOS applications' entitlements?
It seems the described procedure is to be applied on Jailbroken devices.
I'm interested in being able to turn off the screen via my iOS application.
Previous answers point to doing this:
void (*BKSDisplayServicesSetScreenBlanked)(BOOL blanked) = (void (*)(BOOL blanked))dlsym(RTLD_DEFAULT, "BKSDisplayServicesSetScreenBlanked");
Then
BKSDisplayServicesSetScreenBlanked(1); // 1 to dim, 0 to undim
I read that the app also needs com.apple.backboard.client entitlement.
This is where my knowledge stops.
How can I use this in my app if the app is ONLY to be used in a business context controlled via Apple's MDM platform ?
I do not want to jailbreak the device.
First of all, very interesting question. Unfortunately, I don't have the answer, but have some info to share:
I am not aware of any method to add entitlements to 3rd party apps on NON jailbroken phone. You can check my question here: Does anybody know a way to add entitlement to iOS application for non jailbroken device? A lot of upvotes, no anwer thought :(
Generally speaking, entitlement area was reverse engineered to death and there is quite small chance of finding some holes around it. So, I would say, you will have to dump BKSDisplayServices method and search for something else to turn off screen.
I tried to find a way to turn off display on non-jailbroken device too, even posted a bounty on it: Turn off display in iPhone OS (iOS)
There were several answers, but none of them worked well enough.

Resources