【问题标题】:App crashes immediately if not already installed in the device on iOS 10如果尚未安装在 iOS 10 上的设备中,应用程序会立即崩溃
【发布时间】:2016-11-11 21:06:56
【问题描述】:

在将我的应用程序移植到 iOS 10 时,我遇到了一个非常麻烦的问题。我一直在重新安装它,在已经存在的副本上没有问题。然而,当我尝试删除它并从 Xcode 安装它时,应用程序在执行后不久就安静地崩溃了:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

使用简单的最终日志项: [访问] ""

如果我反过来从 AppStore 上的已发布副本下载它,然后从 Xcode 执行它,则该应用程序不会再崩溃。 如果我在 iPad 上执行它,它甚至会显示一条消息以启用本地化,该消息一直停留在窗口上,直到我重新启动设备。 该应用程序也会在模拟器上崩溃。

鉴于我没有返回崩溃报告,它可能是什么以及如何了解更多信息?

【问题讨论】:

    标签: xcode crash beta ios10


    【解决方案1】:

    如果访问任何私有数据(如下所示)而未在 plist 中定义它们(获得用户许可),应用程序将崩溃

    日历活动
    位置

    如果您使用上述任何方法,则需要将隐私声明添加到info.plist 文件中。

    下面一个是访问日历: Privacy - Calendars Usage Description = "some text"

    key = Privacy - Calendars Usage Description value = "some Text"

    【讨论】:

    • 是的,没错。我是通过搜索日志条目找到的。就我而言,我错过了:NSCalendarsUsageDescription 和 NSMotionUsageDescription
    【解决方案2】:

    iOS 10 继续执行隐私政策并实施了新的隐私规则。我们应该记住在我们的下一个项目中实施它们。

    对于您的问题,您需要将以下行添加到info.plist

    <!-- ? Calendars -->
    <key>NSCalendarsUsageDescription</key>
    <string><Your description goes here></string>
    

    以下是其余的隐私规则:

    <!-- ? Photo Library -->
    <key>NSPhotoLibraryUsageDescription</key>
    <string><Your description goes here></string>
    
    <!-- ? Camera -->
    <key>NSCameraUsageDescription</key>
    <string><Your description goes here></string>
    
    <!-- ? Microphone -->
    <key>NSMicrophoneUsageDescription</key>
    <string><Your description goes here></string>
    
    <!-- ? Location -->
    <key>NSLocationUsageDescription</key>
    <string><Your description goes here></string>
    
    <!-- ? Location When In Use -->
    <key>NSLocationWhenInUseUsageDescription</key>
    <string><Your description goes here></string>
    
    <!-- ? Location Always -->
    <key>NSLocationAlwaysUsageDescription</key>
    <string><Your description goes here></string>
    
    <!-- ? Calendars -->
    <key>NSCalendarsUsageDescription</key>
    <string><Your description goes here></string>
    
    <!-- ⏰ Reminders -->
    <key>NSRemindersUsageDescription</key>
    <string><Your description goes here></string>
    
    <!-- ? Motion -->
    <key>NSMotionUsageDescription</key>
    <string><Your description goes here></string>
    
    <!-- ? Health Update -->
    <key>NSHealthUpdateUsageDescription</key>
    <string><Your description goes here></string>
    
    <!-- ? Health Share -->
    <key>NSHealthShareUsageDescription</key>
    <string><Your description goes here></string>
    
    <!-- ᛒ? Bluetooth Peripheral -->
    <key>NSBluetoothPeripheralUsageDescription</key>
    <string><Your description goes here></string>
    
    <!-- ? Media Library -->
    <key>NSAppleMusicUsageDescription</key>
    <string><Your description goes here></string>
    

    希望这会有所帮助。 :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-07
      • 2018-01-11
      • 2013-04-04
      • 1970-01-01
      • 2023-03-08
      • 1970-01-01
      • 2017-09-10
      • 1970-01-01
      相关资源
      最近更新 更多