【问题标题】:Ti.Media.queryMusicLibrary crashes the app after new update?Ti.Media.queryMusicLibrary 新更新后应用程序崩溃?
【发布时间】:2016-09-19 08:20:26
【问题描述】:

在新的OS 10 Apple 我添加了访问music library 的新权限,我的问题是Ti.Media.queryMusicLibrary,当我调用此方法时应用程序崩溃,我试图搜索条件以检查用户是否已经授予访问或请求访问音乐库的权限找不到它们!

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

升级到ios 10 和appcelerator SDK 到 5.5.0.GA 后,调用上述方法时应用会崩溃!

【问题讨论】:

    标签: ios appcelerator


    【解决方案1】:

    尝试将以下键添加到您的 tiapp.xml ios 标签:

    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>
    

    还有,

    • 将 Ti 代码包装在 try-catch 块中以更安全地使用。

    • 根据当前文档,有一种方法可以检查 Audio Permissions,但我不确定它是否会请求音乐库权限,并且它仅适用于不可用的 Ti SDK 6.0.0对公众来说。

    有关更多信息,请参阅以下链接:

    Music Library Permission

    iOS 10 Music Library Permission

    【讨论】:

      猜你喜欢
      • 2019-01-22
      • 1970-01-01
      • 2012-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多