Open iOS Settings App (top level - not deep link into the App Settings page) - iOS 12/13 - ios

I'm working on a iOS App which interacts with different hardware. We access and configure these devices using a "Soft AP" work flow (ie hotspot)
Our preference is to use NEHotspotConfigurationManager to automate the process for the user and in most cases this works fine.
However, in those edge cases where it doesn't (ie iOS 13+ and location services) we'd like to make the workflow as simple for the user as possible.
Currently we have a nice list of steps that the user needs to take:
Press/swipe home
Open Settings
Navigate to WiFi settings
Find and tap the specified WiFi SSID
Return to the App
It's really not pleasant at all.
I'm aware that there is not official way to open the WiFi settings and I can live with that, but recently I was mucking around with the Wyze App and pairing one of their light bulbs and noted that they have manual workflow which opens the top level Settings page - NOT the App's settings. (nb: The Wyze App also has "app settings")
So, after some more reading, I find that UIApplication.openSettingsURLString will open the App's specific settings page, which is cool and everything, but this is not what I need. I'd be really awesome if it was "officially" possible to launch the iOS Settings App and NOT have it open the App's settings, but just land on the top level page.
I know if the App has no settings, this is the behaviour I will get, but our App does (and I can't be changed)
I don't want to/can't use URL schemes like prefs:root unless it can be guaranteed not to be rejected by Apple!
And, yes, I look at a lot of different blogs and questions on the subject, including A Comprehensive Guide to All 120+ Settings URLs Supported by iOS and iPadOS 13.1 - but I'd like to not have the App rejected

Related

Universal Links on macOS

Since iOS9, universal links work on iOS, but I am wondering if there is something like that on macOS? We have an application that is a macOS-App with a corresponding Web-App, and we would love links clicked by the user to open in the Mac-App instead of opening the browser with the target-link.
Is that anyhow possible on macOS? I just found samples for iOS, but none for macOS?!?
Supporting Universal Links on macOS requires support from both your app and your website (and macOS 10.15+).
See Apple's documentation Allowing Apps and Websites to Link to Your Content for details (the article deals with iOS, tvOS and macOS deep links), and its sub-articles Enabling Universal Links as well as Handling Universal Links.
Quick overview:
Basically, it's the same as on iOS: you need to create an apple-app-site-association file that is hosted on your server either in the root directory or in the .well-known directory (described in "Enabling Universal Links" linked above). It describes which URL paths can be passed to your app. It's important that this file is valid JSON (validate it!) and is served via HTTPS with a valid certificate and without any redirects!
You need to enable the "Associated Domains" capability in your provisioning profile. Details depend on whether Xcode manages your profiles or not. In your entitlements file (usually editable via the "Signing & Capabilities" tab of your target in Xcode) you need add the corresponding associated domain, like applinks:my.domain.example (no https:// or anything, just the raw domain name).
Then you need to implement application(_:continue:restorationHandler:) in your app delegate to handle the Universal Link.
It can be annoying to make macOS pick up the association for the first time during development. Debugging hints:
Open Console.app and filter for swcd, that's the daemon responsible for associated web credentials and Universal Links. Sometimes you see hints why it did not work (like refusing the apple-app-site-association file).
Also I had to kill the swcd daemon to make it get restarted by launchd and then pick up changes/fixes I did to the apple-app-site-association file. Both iOS and macOS should usually reload this file on "app installation"1 (haven't seen this getting specified more clearly; I guess they mean App Store installs/updates but I don't know about when this is loaded for macOS apps distributed outside the App Store).
Also, be aware that entering a Universal Link in Safari will not hand off to your app: Apple has stated in the dev forums2 that they believe if a user is already in the browser environment they want to stay there and not suddenly move to an app. Therefor, to test the Universal Link, open Notes.app, create a new note and enter/paste the Universal Link you want to test there. You can then click it and get asked whether you want to open this in your app.
1) Sorry, don't have a dev forum link where I read this.
2) Again, sorry, don't have a link right now. Saw this stated at least two times by Apple employees, both cited the Notes trick. Even though they were talking about iOS there, this behaviour is the same on macOS as well.

Is there a way to access and modify iOS settings with Swift?

Are there any classes or frameworks out there that allow my app to access and modify iPhone settings of the device used to visit my app? I know there's plenty of apps out there which (for example) can change the screen brightness of the device, so I was wondering if it's also possible to modify other settings you can manage in the Settings app on your device (i.e. automatic device lock, time and date, etc.).
No this can't be done... What you can do is to open the settings and that's it. Apple does not allow you to change anything outside your application.

How to open device settings app not the app settings programmatically in iOS 8.0+

I am working on an app in which I need to open the device settings app on button client rather than app settings. I am using UIApplicationOpenSettingsURLString - but this opens the app settings page not the root level for device settings.
So, may I please get some suggestions on how to open the device settings app and may I also know is there any possibility to open the wi-fi settings page in the device settings programmatically.
You con only open the app-settings as you mentioned above.
If it would would it would also be listed in the documentation:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/#//apple_ref/doc/constant_group/Settings_Launch_URL
Even Apps like GoPro or Twitter just give instructions how to enter the settings rather then linking directly.

In-app preferences screen in an iOS 7 app

I'm fairly new to iOS development and I am porting an Android app to iOS 7. The Android app provides a screen that allows the user to change a number of non persistent settings. Because these are not saved, it doesn't seem appropriate to me to expose them, on iOS, as preferences via a settings bundle and the built-in Settings app. So I'm looking at an in-app settings screen, which I understand is allowed - but perhaps not encouraged - by Apple.
Some questions:
Am I correct that an in-App approach is allowed by Apple? Most example code seems to use settings bundles. Am I going to have problems when the app is submitted to the App Store?
I can put the settings UI in a simple UITableViewController, but is there an approved way to expose this to the user? XCode 5 doesn't provide a settings identifier (and icon) for toolbar buttons, and the "Info" identifier (letter i inside a circle) seems to have been dropped too. Should I use a custom icon? Are there any de facto standards?
I haven't seen this kind of UI element before on iOS but my exposure to the platform as a user is limited.
There is nothing wrong with doing an in-app preference (table)view. You won't be rejected for that (this point seems to be way too much exagerated outside the iOS community). There are guidelines that you can follow: iOS Human Interface Guidelines... or not. As long as you don't use private APIs (assuming you know how to access them anyway), you're fine! So you can use a custom icon, the "i" button, or any UI element that convey the reasonable meaning of providing access to more info/preference.
In your code, you can use the class NSUserDefaults (with the standardUserDefaults) to store your preferences.
Many apps have in-app settings. It's fine. Apple even states that it is fine. Just don't have both.
Use a custom icon. Many apps seem to use an icon that looks like a gear.

Open iPhone/iPad settings panel

My app needs feature to open iPhone/iPad "Mail, contacts, Calendars" settings panel and automatically scroll to view default calendar settings row. Any sample or idea?
I will put it under the IBAction.
The URL scheme for programmatically launching Settings.app to a particular settings panel was briefly exposed (though I'm not sure if it was documented) in iOS 5. However, the capability has been suppressed for third-party apps in iOS 5.1. As it stands, there is currently no way to do this from a third-party app on the latest version of the OS - at least, not in a way that won't get your app rejected from the App Store. There's likely a jailbreak way to do this, but I don't dabble in that, so I wouldn't know.

Resources