简体   繁体   中英

How do I open my App's Settings when they don't exist

My app requires access to the user's media library. My question relates tho the following scenario:

  1. No iOS Settings entry exists for this app.
  2. The user presses link to launch Apple's Media Picker.
  3. I pop up Apple's Media Library Access Authorization dialog MPMediaLibrary.requestAuthorization()
  4. The user presses 'Don't Allow'
  5. The user again presses link to launch Apple's Media Picker.
  6. I pop up an alert dialog explaining issue and providing button to open the app's iOS Settings.

     UIApplication.shared.open(URL(string:UIApplicationOpenSettingsURLString)!) 

This works fine as long as the iOS Settings app/screen is not open. The iOS Settings app launches and opens my app's newly created settings.

If iOS Settings app/screen is open ( not to my app, just open somewhere ), the iOS Settings app appears and is positioned where ever it was. Not what I want. If I switch back to my app, pop up the dialog, and do the open URL a second time, the iOS setting are opened for my app.

Is this normal behavior? How do I correct it?

Stackoverflow does a good job of presenting links to existing questions that may be the answer I'm looking for, but no go.


I am still stymied by my app settings issue. Further testing has brought to lite a related issue. Like the settings, my app icon does not appear. Both problems appear to be resolved by a 2nd installation. I thought that by providing details on the app icon, someone might see the problem.

Mac Mini
Mojave 10.14.4
Xcode 10.2
Xcode - Project - IOS Deployment Target = 11.0
Xcode - Target - Deployment Targets = 12.1
Xcode - Swift v5

Physical devices:
- iPhone 6plus ios 12.1.3
- iPhone X iOS 12.1.4

Behavior:

 - installation on Xcode Simulator results in: * icon appears as it should with initial installation.(multiple devices tested) - installation on physical devices by Xcode side-loading via debugger results in: * after initial installation, icon is missing. * app runs as expected. * ios settings entry exists. * ios iPhone storage entry exists. * 2nd debug run, icon appears. (2nd run can be immediate or after device disconnected/reconnected or Xcode restarted) - installation of ipa on physical devices by Xcode -> Window -> Devices & Simulators results in: * after initial installation, icon is missing. * (of course app cannot be run without icon) * ios settings entry exists. * ios iPhone storage entry exists. * 2nd ipa installation, icon appears. (2nd run can be immediate or after device disconnected/reconnected or Xcode restarted) 

Note: I have recreated and re-generated my icons by several different tools. No change in behavior.

Note: I have downloaded a couple of simple technology demonstration Xcode projects from GitHub. They do not contain any icons. They rely on the ios default icon. Same behavior as my app.

Any insights or outright guesses would be appreciated.

For what it's worth..... I submitted the app to Apple for review. It was approved and is on the app store (Song Announcer). The ipa that I uploaded to App Store Connect exhibited the same "no app icon when initially installed" behavior when installed on my devices via Xcode. When downloaded from the App Store, the icon appears as expected.

Go figure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM