[英]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:
我的问题与以下情况有关:
MPMediaLibrary.requestAuthorization()
MPMediaLibrary.requestAuthorization()
I pop up an alert dialog explaining issue and providing button to open the app's iOS Settings. 我弹出一个警告对话框,解释问题并提供按钮以打开应用程序的iOS设置。
UIApplication.shared.open(URL(string:UIApplicationOpenSettingsURLString)!)
This works fine as long as the iOS Settings app/screen is not open. 只要iOS设置应用程序/屏幕未打开,此工作正常。 The iOS Settings app launches and opens my app's newly created settings.
iOS设置应用程序启动并打开我的应用程序新创建的设置。
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. 如果iOS设置应用程序/屏幕已打开( 不是我的应用程序,只是在某处打开 ),iOS设置应用程序将出现并定位到原来的位置。 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.
如果我切换回我的应用程序,弹出对话框,再次打开URL,就会为我的应用程序打开iOS设置。
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. Stackoverflow很好地提供了可能是我正在寻找的答案的现有问题的链接,但没有去。
Mac Mini Mac迷你
Mojave 10.14.4 莫哈韦10.14.4
Xcode 10.2 Xcode 10.2
Xcode - Project - IOS Deployment Target = 11.0 Xcode - 项目 - IOS部署目标= 11.0
Xcode - Target - Deployment Targets = 12.1 Xcode - 目标 - 部署目标= 12.1
Xcode - Swift v5 Xcode - Swift v5
Physical devices: 物理设备:
- iPhone 6plus ios 12.1.3 - iPhone 6plus ios 12.1.3
- iPhone X iOS 12.1.4 - 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. 注意:我从GitHub下载了几个简单的技术演示Xcode项目。 They do not contain any icons.
它们不包含任何图标。 They rely on the ios default icon.
他们依赖于ios默认图标。 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. 为了它的价值......我将该应用程序提交给Apple进行审核。 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.
当我通过Xcode安装在我的设备上时,我上传到App Store Connect的ipa展示了相同的“最初安装时没有app图标”行为。 When downloaded from the App Store, the icon appears as expected.
从App Store下载时,图标将按预期显示。
Go figure. 去搞清楚。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.