简体   繁体   English

应用程序的 Info.plist 必须包含 NSMotionUsageDescription 键

[英]The app's Info.plist must contain an NSMotionUsageDescription key

I am getting the following error during the runtime:我在运行时收到以下错误:

This app has crashed because it attempted to access privacy-sensitive data without a usage description.此应用已崩溃,因为它试图在没有使用说明的情况下访问隐私敏感数据。 The app's Info.plist must contain an NSMotionUsageDescription key with a string value explaining to the user how the app uses this data.应用程序的 Info.plist 必须包含一个 NSMotionUsageDescription 键和一个字符串值,向用户解释应用程序如何使用此数据。

I have added the key to the plist file:我已将密钥添加到 plist 文件中:

<!-- 🏊 Motion -->
<key>NSMotionUsageDescription</key>
<string>This app needs to be able to access your motion use</string>

and this the code in AppDelegate:这是 AppDelegate 中的代码:

if ([CMMotionActivityManager isActivityAvailable])
{
    CMMotionActivityManager *motionManager = [[CMMotionActivityManager alloc] init];
    NSOperationQueue *motionActivityQueue = [[NSOperationQueue alloc] init];

    [motionManager queryActivityStartingFromDate:[NSDate distantPast] toDate:[NSDate date] toQueue:motionActivityQueue withHandler:^(NSArray *activities, NSError *error) {
        if (error && (error.domain == CMErrorDomain) && (error.code == CMErrorMotionActivityNotAuthorized)) {

        } else if (activities || !error) {

        }

        dispatch_async(dispatch_get_main_queue(), ^{

        });
    }];        
}

Why am I keep getting this crash?为什么我总是遇到这个崩溃? I deleted all the derived folder, cleaned the project.我删除了所有派生文件夹,清理了项目。 But still asking me the key?但是还是问我钥匙? Is it an Apple bug?这是苹果的错误吗?

I found the problem. 我发现了这个问题。 I hope one day it will help someone. 我希望总有一天能帮助别人。 Go to Project Settings -> Info -> Under the Custom iOS Target Properties section find the Required background modes and add your key here as well. 转到项目设置 - >信息 - >在自定义iOS目标属性部分下,找到所需的背景模式,并在此处添加您的密钥。 I don't know why not all my plist file keys are here. 我不知道为什么我的所有plist文件键都不在这里。

Go to Targets -> your project target -> build settings -> search for NSMotionUsageDescription Go 到目标 -> 你的项目目标 -> 构建设置 -> 搜索 NSMotionUsageDescription

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 应用的 Info.plist 必须包含一个 NSContactsUsageDescription 键 - The app's Info.plist must contain an NSContactsUsageDescription key 要将此应用配置为iOS路由应用,应用的Info.plist必须包含MKDirectionsApplicationSupportedModes键 - To configure this app as an iOS routing app, the app's Info.plist must contain the MKDirectionsApplicationSupportedModes key 应用程序的 Info.plist 必须包含 NSLocationAlwaysUsageDescription 和 NSLocationWhenInUseUsageDescription。 - The app's Info.plist must contain NSLocationAlwaysUsageDescription & NSLocationWhenInUseUsageDescription. 什么是“应用程序的Info.plist必须包含NSPhotoLibraryAddUsageDescription”的崩溃? - What is the crash of “The app's Info.plist must contain an NSPhotoLibraryAddUsageDescription”? iOS 12-“应用程序的Info.plist必须包含NSMicrophoneUsageDescription密钥” - iOS 12 - “The app's Info.plist must contain an NSMicrophoneUsageDescription key” 错误ITMS-90642:“缺少Info.plist密钥。 您应用的info.plist必须包含“MSMessagesExtensionStoreIconName”键。“ - ERROR ITMS-90642: “Missing Info.plist Key. Your app's info.plist must contain the 'MSMessagesExtensionStoreIconName' key.” 错误 ITMS-90513:缺少 Info.plist 键。 您的应用程序的 Info.plist 必须包含“TVTopShelfImage.TVTopShelfPrimaryImageWide”键 - ERROR ITMS-90513: Missing Info.plist Key. Your app's Info.plist must contain the 'TVTopShelfImage.TVTopShelfPrimaryImageWide' key App Store意外拒绝:NSMotionUsageDescription和NSContactsUsageDescription缺少Info.Plist - Unexpected App Store rejection: Missing Info.Plist for NSMotionUsageDescription and NSContactsUsageDescription 应用程序的 Info.plist 必须包含一个 NSCameraUsageDescription 键和一个字符串值,向用户解释应用程序如何使用这些数据 - The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data 应用程序的 Info.plist 必须包含一个 NSMicrophoneUsageDescription 键和一个字符串值,向用户解释应用程序如何使用此数据 - The app's Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM