最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

swift - I am running into a catch 22 with Info.plist settings in xcode 16 - Stack Overflow

programmeradmin0浏览0评论

I am setting up an app that uses HealthKit and am experiencing a crash due to problems with my Info.plist file. This is the log:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSHealthUpdateUsageDescription must be set in the app's Info.plist in order to request write authorization for the following types: HKQuantityTypeIdentifierStepCount'
*** First throw call stack:
(0x1d31b250 0x1b58f160 0x1d3bab7c 0x3a4f02d0 0x3a4eff2c 0x3a4ef8f0 0xc5595c 0xc55594 0xc56c4c 0x43f23e38 0xc56b9c 0xc56c6c 0x24eb8614)
libc++abi: terminating due to uncaught exception of type NSException

I think the crash is happening because the NSHealthUpdateUsageDescription doesn't have a meaningful string in the Build settings. However, the Info.plist is generated by Xcode at runtime and I cannot modify (or delete) these entries manually, I cannot add new keys in the User-defined section because they already exist, nor do I think I can make a manual Info.plist because there are other settings in the automatically generated one I believe my app needs to run. Any help is appreciated!

I am setting up an app that uses HealthKit and am experiencing a crash due to problems with my Info.plist file. This is the log:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSHealthUpdateUsageDescription must be set in the app's Info.plist in order to request write authorization for the following types: HKQuantityTypeIdentifierStepCount'
*** First throw call stack:
(0x1d31b250 0x1b58f160 0x1d3bab7c 0x3a4f02d0 0x3a4eff2c 0x3a4ef8f0 0xc5595c 0xc55594 0xc56c4c 0x43f23e38 0xc56b9c 0xc56c6c 0x24eb8614)
libc++abi: terminating due to uncaught exception of type NSException

I think the crash is happening because the NSHealthUpdateUsageDescription doesn't have a meaningful string in the Build settings. However, the Info.plist is generated by Xcode at runtime and I cannot modify (or delete) these entries manually, I cannot add new keys in the User-defined section because they already exist, nor do I think I can make a manual Info.plist because there are other settings in the automatically generated one I believe my app needs to run. Any help is appreciated!

Share Improve this question asked Mar 3 at 19:09 iOS_girlieiOS_girlie 133 bronze badges 6
  • See stackoverflow/q/67896404/1187415 – Martin R Commented Mar 3 at 19:14
  • Thank you, I have tried that and it doesn't solve my problem – iOS_girlie Commented Mar 3 at 19:44
  • The contents of the auto-generated Info.plist can be edited in the Info tab of your target: sarunw/posts/what-is-info-plist (see the screenshot for reference) – Alexander Commented Mar 3 at 23:53
  • what I sometimes do to see the content of the Info.plist is to go to the Info tab and add something like Accessibility Bundle Name to it. The Info.plist will then appear by magic in the left panel, where you can Open As->Source Code. You can then manually add new items, or override the default settings, these are not displayed for some reason. Eg: <key>NSHealthUpdateUsageDescription</key> <string>health check</string> – workingdog support Ukraine Commented Mar 4 at 3:25
  • @workingdogsupportUkraine can you please post this as an answer co I can accept it, it worked for me! – iOS_girlie Commented Mar 4 at 14:58
 |  Show 1 more comment

1 Answer 1

Reset to default 0

To see the content of the Info.plist go to the Info tab and add something like Accessibility Bundle Name to it.

The Info.plist will then appear by magic in the Xcode left panel, where you can Open As->Source Code....

You can then manually add new items, or override the default settings, these are not displayed for some reason.

For example:

 <key>NSHealthUpdateUsageDescription</key> 
      <string>health check</string>
发布评论

评论列表(0)

  1. 暂无评论