1
我試圖調用此函數來檢查Apple Music訂閱狀態。我有一個積極的訂閱,並在我的iPhone上聽音樂。 但是當我正在運行測試應用程序時,capability
值無效。Swift 3.1 SKCloudServiceCapability問題
它應該是SKCloudServiceCapability.musicCatalogPlayback
,SKCloudServiceCapability.addToCloudMusicLibrary
或未設置。我只能得到raw value = 257
。
func appleMusicCheckIfDeviceCanPlayback()
{
let serviceController = SKCloudServiceController()
serviceController.requestCapabilities { (capability:SKCloudServiceCapability, err:Error?) in
switch capability {
case SKCloudServiceCapability.musicCatalogPlayback:
print("The user has an Apple Music subscription and can playback music!")
case SKCloudServiceCapability.addToCloudMusicLibrary:
print("The user has an Apple Music subscription, can playback music AND can add to the Cloud Music Library")
case []:
print("The user doesn't have an Apple Music subscription available. Now would be a good time to prompt them to buy one?")
default: print("Something went wrong")
}
}
}
這裏有什麼錯?
在蘋果開發論壇上提問相同: https://forums.developer.apple.com/message/228739#228739 –