交易是这样的:
我正在写一个应用程序,用来播放用户库中的音乐。我正在使用MP授权方法,如下所示:
if .authorized == MPMediaLibrary.authorizationStatus() { // Already authorized? Head on in!
if inDisplayWholeScreenThrobber {
self._showLargeLookupThrobber()
}
if let songItems: [MPMediaItemCollection] = MPMediaQuery.songs().collections {
self._loadSongData(songItems)
self._selectSong()
self._hideLargeLookupThrobber()
}
} else { // Can I see your ID, sir?
MPMediaLibrary.requestAuthorization { [unowned self] status in
switch status {
case.authorized:
if inDisplayWholeScreenThrobber {
self._showLargeLookupThrobber()
}
if let songItems: [MPMediaItemCollection] = MPMediaQuery.songs().collections {
self._loadSongData(songItems)
self._selectSong()
self._hideLargeLookupThrobber()
}
default:
TheBestClockAppDelegate.reportError(heading: "ERROR_HEADER_MEDIA", text: "ERROR_TEXT_MEDIA_PERMISSION_DENIED")
}
}
}诸若此类。在播放任何存储的URI之前,我还会检查授权状态,以防用户改变主意。
问题是:
一旦我授予(或拒绝)授权,系统就会记住我的应用程序,我再也不会被问到了。即使卸载应用程序并重新安装它,也会重新唤醒隐私面板中的开关。
我唯一能让它忘记我的方法就是更改应用程序绑定ID。
这给了我两个问题:
1)以上我做得对吗?
2)如何迫使系统忘记我的应用程序?
发布于 2018-11-13 00:38:16
好的。我想出了一个办法。很烦人,但很管用。
如果您删除应用程序,然后关闭并重新启动设备,状态重置。
https://stackoverflow.com/questions/53269479
复制相似问题