Is it considered a private API to use App-prefs:root? - ios

In my app I'm using [NSURL URLWithString:#"App-Prefs:root=Privacy&path=LOCATION"] to open settings screen. Will it be rejected by apple as according to some sources this is considered a private API?

Yes. The only legal way to open Settings is to use UIApplicationOpenSettingsURLString.

My app just got rejected because of this, so yes, it is considered as private API :)
Here's the rejection notice from Apple:
Your app uses the "prefs:root=" non-public URL scheme, which is a private entity. The use of non-public APIs is not permitted on the App Store because it can lead to a poor user experience should these APIs change.

To resolve this issue, if you are navigating to Settings > Privacy. "Just remove that code" and put a simple alert showing Enable location services.
Because from iOS 10 apple consider it is as private entity. So you can not go through it.

There’s no supported way to open Settings to the Wi-Fi/Language/Location ‘page’. The fact that this worked in iOS 9 is a bug that’s been fixed in iOS 10.
For more info please refer https://forums.developer.apple.com/message/186656#186656

Related

Link to the sound section of the settings app from another app ios

I know similar questions have been asked before about how to open the settings app from another app. However this seems to only allow you to jump to the privacy settings of the sender app within the settings app. I need a way to jump directly to the sound settings menu of the settings app. Can this be done in objective-c specifically, I'm not interested in a swift solution. Thanks.
I think Subsections inside Settings app is private. As I have made some research around it Apple rejects if you submit app for review. An Example case:
Your app uses the "prefs:root=" non-public URL scheme, which is a
private entity. The use of non-public APIs is not permitted on the App
Store because it can lead to a poor user experience should these APIs
change. Continuing to use or conceal non-public APIs in future
submissions of this app may result in the termination of your Apple
Developer account, as well as removal of all associated apps from the
App Store.
Next Steps
To resolve this issue, please revise your app to provide the
associated functionality using public APIs or remove the functionality
using the "prefs:root" or "App-Prefs:root" URL scheme.
If there are no alternatives for providing the functionality your app
requires, you can file an enhancement request.
So that means you are only allowed to use Main section like below.
UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!, options: [:], completionHandler: nil)

How can I check programmatically that list of applications are installed or not in iPhone

In my app I'm showing list of applications.Is it possible to find that the array of applications are installed or not in iPhone.
If any possibility is there anyone please provide related code in swift to check the array of applications is installed or not in iPhone.
In the old times you could have used canOpenURL with a library like iHasApp. This only works for apps that register custom deep link schemes, but it was capturing the majority of important apps.
But since iOS 9 there seems to be a limitation to this approach - see How to reset `canOpenURL` limit in iOS9?
In general your app is not allowed to know what else is installed in the system for privacy reasons.
From your sandboxed application
By default from an Application Layer, you are not allowed to use the private API's to check what other applications are installed on your device.
Workarounds
If the target third-party app supports URL schemes. You can check the url scheme they implement using [UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"someScheme://randomText"]] .
(Not recommended)Take a look at private frameworks like /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices LSApplicationWorkspace . There is a method called allInstalledApplications in LSApplicationWorkspace which should work, check runtime headers for more info.
Off topic ~ For MDM devices
Using Mobile Device Management (MDM) protocol, you can use InstalledApplicationList command to get the array of installed applications on the target device. The following is the response for the said MDM command.

App get rejected due to uses the "prefs:root=" non-public URL scheme [duplicate]

In my app I'm using [NSURL URLWithString:#"App-Prefs:root=Privacy&path=LOCATION"] to open settings screen. Will it be rejected by apple as according to some sources this is considered a private API?
Yes. The only legal way to open Settings is to use UIApplicationOpenSettingsURLString.
My app just got rejected because of this, so yes, it is considered as private API :)
Here's the rejection notice from Apple:
Your app uses the "prefs:root=" non-public URL scheme, which is a private entity. The use of non-public APIs is not permitted on the App Store because it can lead to a poor user experience should these APIs change.
To resolve this issue, if you are navigating to Settings > Privacy. "Just remove that code" and put a simple alert showing Enable location services.
Because from iOS 10 apple consider it is as private entity. So you can not go through it.
There’s no supported way to open Settings to the Wi-Fi/Language/Location ‘page’. The fact that this worked in iOS 9 is a bug that’s been fixed in iOS 10.
For more info please refer https://forums.developer.apple.com/message/186656#186656

How to get apps names list Swift 4

I'm new to IOS developing and I've been looking for a way to get list of apps names installed on a device but from what I have found is that Apple removed this from Swift 4. Is it true and if so is there an alternative way to get them?
There is no way to get list of installed apps on IOS device , but if you have the url Scheme you can check with UIApplication.shared.canOpenURL method whether an app is installed or not
This was never a feature on iOS because it would seriously hurt a user's privacy if it was. The solution using canOpenUrl works is you know the url scheme for a certain app but in theory any app can subscribe to any scheme so there are no guarantees there either.

How to receive sharing content in my app?

I would like to add my app to the UIActivityViewController in other apps. How can I add/register my app to allow other apps to send content to my app? How should I receive this content?
Thank you very much to all of you that answered to my question.
With your answers I realized I have to use a Shared Extension. I have found a really nice video that explains how I have to handle the received information: https://www.youtube.com/watch?v=TBC2m8BbcCE. Maybe it could be useful for somewhere in the future.
In your Xcode project, go to file > new > target and select "Share Extension".
Your Share Extension is the extension that will provide an option in the share sheet inside other apps.
To learn more about share extensions, check out Apple's guide.

Resources