gpt4 book ai didi

ios - 在 iOs 10 中请求位置时应用程序崩溃

转载 作者:行者123 更新时间:2023-11-28 18:50:59 26 4
gpt4 key购买 nike

在我的应用程序中,我用来获取位置数据并将其发送回服务器。该应用程序在以前的版本中运行良好,但在 iOs 10 中崩溃。我使用的是 Xcode 8。日志中显示以下消息。

Couldn't find the "com.apple.private.externalaccessory.showallaccessories" entitlement
[MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/delta/Library/Developer/CoreSimulator/Devices/EE3BD084-BA73-44F6-AD95-BE49BBE838AC/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
[MC] Reading from private effective user settings.

那么我该如何解决这个问题。

最佳答案

在 iOS 10 中,如果你想访问私有(private)数据,一个显着的变化是你必须提前声明,否则你的 App 会崩溃。

如果您正在使用下面列出的任何框架

Contacts, Calendar, Reminders, Photos, Bluetooth Sharing, Microphone, Camera, Location, Health, HomeKit, Media Library, Motion, CallKit, Speech Recognition, SiriKit

你必须在Info.plist中声明描述

这是您必须为 iOS10 声明的 Info.plist key 的完整列表。

    <!-- Photo Library -->
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) photo use</string>

<!-- Camera -->
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) camera use</string>

<!-- Microphone -->
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) microphone use</string>

<!-- Location -->
<key>NSLocationUsageDescription</key>
<string>$(PRODUCT_NAME) location use</string>

<!-- Location When In Use -->
<key>NSLocationWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) location use</string>

<!-- Location Always -->
<key>NSLocationAlwaysUsageDescription</key>
<string>$(PRODUCT_NAME) always uses location </string>

<!-- Calendars -->
<key>NSCalendarsUsageDescription</key>
<string>$(PRODUCT_NAME) calendar events</string>

<!-- Reminders -->
<key>NSRemindersUsageDescription</key>
<string>$(PRODUCT_NAME) reminder use</string>

<!-- Contacts -->
<key>NSContactsUsageDescription</key>
<string>$(PRODUCT_NAME) contact use</string>

<!-- Motion -->
<key>NSMotionUsageDescription</key>
<string>$(PRODUCT_NAME) motion use</string>

<!-- Health Update -->
<key>NSHealthUpdateUsageDescription</key>
<string>$(PRODUCT_NAME) heath update use</string>

<!-- Health Share -->
<key>NSHealthShareUsageDescription</key>
<string>$(PRODUCT_NAME) heath share use</string>

<!-- Bluetooth Peripheral -->
<key>NSBluetoothPeripheralUsageDescription</key>
<string>$(PRODUCT_NAME) Bluetooth Peripheral use</string>

<!-- Media Library -->
<key>NSAppleMusicUsageDescription</key>
<string>$(PRODUCT_NAME) media library use</string>

<!-- Siri -->
<key>NSSiriUsageDescription</key>
<string>$(PRODUCT_NAME) siri use</string>

<!-- HomeKit -->
<key>NSHomeKitUsageDescription</key>
<string>$(PRODUCT_NAME) home kit use</string>

<!-- SpeechRecognition -->
<key>NSSpeechRecognitionUsageDescription</key>
<string>$(PRODUCT_NAME) speech use</string>

<!-- VideoSubscriber -->
<key>NSVideoSubscriberAccountUsageDescription</key>
<string>$(PRODUCT_NAME) tvProvider use</string>

还有

能够与外部配件通信的应用必须在其 Info.plist 文件中声明它们支持的协议(protocol)。

To declare the protocols your app supports, you must include the UISupportedExternalAccessoryProtocols key in your app’s Info.plist file. This key contains an array of strings that identify the communications protocols that your app supports.

希望对您有所帮助..!

关于ios - 在 iOs 10 中请求位置时应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40883825/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com