2016-09-19 86 views
0

OS 10蘋果增加了新的訪問權限music library,我的問題與Ti.Media.queryMusicLibrary,當我調用這個方法的應用程序崩潰,我試圖搜索條件來檢查用戶已經提供訪問或請求訪問音樂庫找不到他們!Ti.Media.queryMusicLibrary在新更新後崩潰了應用程序?

var musicList = Ti.Media.queryMusicLibrary({ 
    mediaType : Ti.Media.MUSIC_MEDIA_TYPE_MUSIC 
}); 

升級後 SDK來5.5.0.GA,當u調用上述方法的應用程序會崩潰!

任何建議通過增加以下關鍵看你tiapp.xml IOS標籤非常讚賞

回答

1

嘗試:

NSAppleMusicUsageDescription

<ios> 
     <plist> 
      <dict> 
       <key>NSAppleMusicUsageDescription</key> 
       <string>Allow this app to access your music library.</string> 

       <key>UISupportedInterfaceOrientations~iphone</key> 
       <array> 
        <string>UIInterfaceOrientationPortrait</string> 
       </array> 
       <key>UISupportedInterfaceOrientations~ipad</key> 
       <array> 
        <string>UIInterfaceOrientationPortrait</string> 
        <string>UIInterfaceOrientationPortraitUpsideDown</string> 
        <string>UIInterfaceOrientationLandscapeLeft</string> 
        <string>UIInterfaceOrientationLandscapeRight</string> 
       </array> 
       <key>UIRequiresPersistentWiFi</key> 
       <false/> 
       <key>UIPrerenderedIcon</key> 
       <false/> 
      </dict> 
     </plist> 
    </ios> 

此外,

  • 將try代碼封裝在try-趕上更安全的使用塊。

  • 根據目前的文檔,有一種方法來檢查Audio Permissions,雖然我不確定它是否會要求音樂庫的權限,它只能在Ti SDK 6.0.0上工作,但對於一般還不可用上市。

更多看到這些鏈接:

Music Library Permission

iOS 10 Music Library Permission