Healthkit - entitlements file and plist file - ios

I have downloaded sample codes which supports healthkit framework.I also read some blogs related healthkit.
What i read and found in code , to support Healthkit 2 things required.
1) set yourApp.entitlements with "com.apple.developer.healthkit"
2) in plist file add "Required device capabilities" with arm7 and healthkit.
I have done with both of above requirements and it works.
BUT , It works event i removed both..If i remove entitlement file and also remoe "Required device capabilities" it works.
So what is the need of above 2 ? it seems not mandatory then why each blogs and sample code suggests it.

The first one is definitely required but the entry within you .plist file is not. Evenmore the entry in your plist file can cause you troubles when updating an existing app. Have a look at the post http://jademind.com/blog/posts/healthkit-api-tutorial/ to get some more details and notes on this topic.

The required device capability entitlement is only necessary if you want to restrict the application to run on devices that support HealthKit. If your app requires HealthKit for its primary functionality, then you should use the required device capability entitlement to ensure that the app does not get purchased for devices that cannot support it (iPads for instance).

Both these are required when you want to run your app on device

Related

Watch only app binary rejected due to missing HealthKit info.plist keys

I am having a confusing problem with my Apple Watch only app that uses HealthKit. I keep receiving Binary Rejected upon uploading to App Store Connect due to missing NSHealthShareUsageDescription and NSHealthUpdateUsageDescription keys in the info.plist. I have these keys in my info.plist and have verified that they are identical to my previous iOS apps that utilize Helathkit and have been successfully been uploaded. Is this a problem with WatchOS only apps specifically?
My info.plist keys
I figured it out on this site: learningswift.brightdigit.com. Apparently I needed to create a third Info.plist file in the project under the Xcode project file.

WatchOS and location entitlement

I've been working on adding a watchapp to a fitness tracker I already have in the app store. I've been able to load it onto my physical phone and watch without trouble in the past.
I've recently added Location tracking to the watch app, so that I can track the path the user has run/biked and show it to them on the phone when they review the workout. Since doing that, I'v been getting errors from Xcode when I try to load the app to my phone; I think these are expected errors, but I'm having trouble understanding from the docs/interface of Xcode and developer.apple.com where to make the fix.
I've added the entitlement in the watch app entitlements file:
As the error says, I've switched to manual signing and generated a new provisioning profile, but I get the same error. I don't see a place to add a location capability in the provisioning profile in developer.apple.com:
It seems like the only way for the provisioning profile to get the entitlement is from Xcode, since there's not a place to add it in developer.apple.com? That seems wrong, and isn't working in any case. I'm not finding help for my case in the Xcode docs (or I'm looking in the wrong place). Any help would be greatly appreciated.
I am using location services on iOS and watchOS, but I have nothing related to it in both entitlement files. The docs say:
Set entitlement values in order to enable iCloud, push notifications,
Apple Pay, and App Sandbox.
They don’t mention location services.
So it might be enough to delete the Location entitlement, and enable automatic signing again.
Of course, you had to set in your iOS info.plist, as required, NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription, and in your watch extension info.plist NSLocationWhenInUseUsageDescription.
Are you using latest Xcode? Did you set the entitlement in the target menus? They all have toggles now, from what I remember. Once you do that, normally Xcode can resolve signing issues for you. If you look at the signing section in Xcode, does it indicate a signing problem there? (And have you restarted Xcode at least once while trying to resolve the signing problem?)
Note that the location entitlement should be on your WatchKit Extension, not on the Watchkit App.
Have a look at the Capabilities tab (it is the one for control of Entitlements, so you do not have to edit the plist directly.)
Have you tried creating a new project as a test to see if that works? Your screenshot does not match target naming of what I see in Xcode for a WatchKit App. In Xcode 10.1, the WatchKit App plist editor will show 'app name' WatchKit App and the extension plist editor shows 'appname' WatchKit Extension. I see your screenshot showing 'blank' Watchapp Extension. Possibly you edited the project name and that is not an issue? Another thing to verify is that the plist is not corrupt.

ipa uploaded successfully but not showing after upload completes xcode 8

While my build is uploading, it shows in iTunes Connect, but when uploading gets completed successfully the build no longer shows on iTunes Connect, it get vanished from there.
I tried with both XCode 8 and application loader. I added all required keys in info.plist for usage descriptions.
First of all, check the message from Apple. Recently I also faced same issue. The reason was pretty simple, I missed description keys in info.plist. These keys are mandatory in Xcode 8 + iOS 10 SDK
This app attempts to access privacy-sensitive data without a usage
description. The app's Info.plist must contain an
NSPhotoLibraryUsageDescription key with a string value explaining to
the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage
description. The app's Info.plist must contain an
NSBluetoothPeripheralUsageDescription key with a string value
explaining to the user how the app uses this data.
Additionally, I was also forced to include "Camera usage description key". I uploaded again with new bundle number, and build reflected in iTunes connect.
This is overcrowded question so this problem is multiple type of process you can try.
This processing step taking around 15 to 20 minutes as it usually does, now applications stay in processing for 24 hours or more at a time.
Try 1 - Upload new binary:
upload a new binary of the same application with an incremented build number.
Try 2 - Avoid using Bitcode
If you've enabled Bitcode in your application,This can be done by going to Setup: Project>Build Settings>All>Build Options and setting "Enable Bitcode" to NO after this you should recompile the app, archive and upload it again using iTunes Connect.
Try 3. Use Application Loader
use the Application Loader utility to upload a new build of your app. After the upload process finishes, your app should also get out of the "Processing" status.
Try 4. Use the latest Xcode.
iTunes Connect "Processing" issue and managed to solve it, using Latest Xcode to build and upload your app might just be the winning solution for your problems.
Try 5. Go to Contact
"Resources & Help" in iTunes Connect. Select "Contact Us".
There are 2 possibilities in this:
1. You are using outdated Xcode to upload. Try the latest one, because apple support stop working for old xcodes after launch of new xcode version.
Your permissions in plist are not available, like you may be using camera feature, photos feature, location feature but permissions are not given in plist so kindly add keys for the permissions in plist..
The best way to figure out about the issue is to check the email ID that is registered with Apple developer account, you must have received email from Apple about the missing component in code. That makes the build of application invalid, so check email first to figure out what exactly the main issue is. It clearly states the next steps. Most of the time above 2 issues are found when build is not appearing in iTunes.

Xcode 8 Invalid Binary

My app only require iCloud UIDocument service. However, it sent me a warning email below and a invalid binary warning notification after uploading to iTunesConnect from Xcode 8.
It is non-sense to ask me to add NSCalendarsUsageDescription and NSBluetoothPeripheralUsageDescription description on Info.plist
May I miss some setting after upgrade Xcode from 7 to 8 ??
This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCalendarsUsageDescription key with a string value explaining to the user how the app uses this data.
This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSBluetoothPeripheralUsageDescription key with a string value explaining to the user how the app uses this data.
You need to put values for the two keys mentioned in your Info.plist file:
NSCalendarsUsageDescription
NSBluetoothPeripheralUsageDescription
e.g. "MyAPP needs access to your calendar for events"
If you do not need/use these capabilities, then there is something in your binary that's triggering Apple's static analyzer.
Check 3rd party libs in your project because some of them have been causing similar issues to this (in your case it may well be AdMob) - some have updated their SDKs to fix it, so make sure you're on the latest version of 3rd party SDKs.
Check the Capabilities section of your App's target configuration - is there anything in there that is unnecessary - particularly in the "Background Modes" section.
I had the same problem, review your info.plist and tries to add the following fields
Privacy - Photo Library Usage Description
or
Bluetooth Sharing - NSBluetoothPeripheralUsageDescription
You can check here the permissions that now requires iOS 10 in its info.plist here: https://blog.xamarin.com/new-ios-10-privacy-permission-settings/
This worked for me.

Device compabilities issue in iOS

We uploaded an app where in the first version we added to device capabilities “telephony” to restrict only iPhone devices in the info plist. In the second version we forgot to add “telephony” and we submitted to the App store. Third version we are planning to upload with device capabilities as “telephony” but while submitting to the App Store it shows the warning:
This bundle is invalid. The key UIRequiredDeviceCapabilities in the
Info.plist may not contain values that would prevent this application
from running on devices that were supported by previous versions.
How can we resolve this issue, if we require the device capability “telephony” for application lifetime, but due to my mistake on the second version we forgot to add the required device capabilities? What is the solution for it?
Thanks in advance.
I have the same warning when added to device capabilities “healthkit” t in the info plist.
This bundle is invalid - The key UIRequiredDeviceCapabilities in the Info.plist may not contain values that would prevent this application from running on devices that were supported by previous versions.
delete Info.plist -> Required device capabilities -> Item -> healthkit,upload again to submit review success.
Unfortunately it doesn't seem possible to fix this error. According to Apple's Technical Q&A:
Depending on how you narrow the devices your app supports, you will
get one of two error messages from Xcode when uploading your update to
the App Store.
"This bundle is invalid. The key UIRequiredDeviceCapabilities in the
Info.plist may not contain values that would prevent this application
from running on devices that were supported by previous versions."
When you see this error message, you have added a new constraint,
under the UIRequiredDeviceCapabilities key in your app's info.plist
file.
Important: Because you can't add UIRequiredDeviceCapabilities
restrictions after an app is in the store, be sure to plan ahead by
choosing requirements you will be comfortable supporting indefinitely
going forward.
You are allowed to relax UIRequiredDeviceCapabilities restrictions, but not tighten them. Once restrictions are relaxed they cannot be tightened back again.

Resources