HealthKit requestAuthorization returns code 100: “Authorization session timed out”
All of my HealthKit authorization requests are timing out with this error. Nothing in my code has changed, but I recently switched Xcode over to a new Apple ID account.
I have a development team setup, a provisioning profile configured, and the HealthKit Capability and Entitlement working. My app builds and runs fine, but any time I make a requestAuthorization
call, I get a timeout for no apparent reason. There's no additional information in the error, and everything appears to be configured properly, so I'm pretty lost on what could cause this.
I've tried both simulators and devices with the same issue. The dialog for HealthKit auth never appears. I can go into the Health app after the fact and turn on the necessary data sharing, but this is a not an acceptable workaround.
What can cause healthKitStore requestAuthorization timeout errors?
I am 99% sure this is a configuration issue, but having gone through the process multiple times, and re-created numerous certs, provisioning profiles etc, I don't know what the problem could be. Where should I be looking for config issues? There is essentially zero documentation on this, and I've only found 2 results on Google related to this with no solutions.
let healthKitTypesToRead = [...]
let healthKitStore:HKHealthStore = HKHealthStore()
healthKitStore.requestAuthorization(toShare: nil, read: healthKitTypesToRead) { (success, error) -> Void in
if( completion != nil ) {
completion(success, error as? NSError)
}
}
ios health-kit
add a comment |
All of my HealthKit authorization requests are timing out with this error. Nothing in my code has changed, but I recently switched Xcode over to a new Apple ID account.
I have a development team setup, a provisioning profile configured, and the HealthKit Capability and Entitlement working. My app builds and runs fine, but any time I make a requestAuthorization
call, I get a timeout for no apparent reason. There's no additional information in the error, and everything appears to be configured properly, so I'm pretty lost on what could cause this.
I've tried both simulators and devices with the same issue. The dialog for HealthKit auth never appears. I can go into the Health app after the fact and turn on the necessary data sharing, but this is a not an acceptable workaround.
What can cause healthKitStore requestAuthorization timeout errors?
I am 99% sure this is a configuration issue, but having gone through the process multiple times, and re-created numerous certs, provisioning profiles etc, I don't know what the problem could be. Where should I be looking for config issues? There is essentially zero documentation on this, and I've only found 2 results on Google related to this with no solutions.
let healthKitTypesToRead = [...]
let healthKitStore:HKHealthStore = HKHealthStore()
healthKitStore.requestAuthorization(toShare: nil, read: healthKitTypesToRead) { (success, error) -> Void in
if( completion != nil ) {
completion(success, error as? NSError)
}
}
ios health-kit
1
Do you run the requestAuthorization in the main thread?
– Christos Koninis
Jan 9 at 8:19
add a comment |
All of my HealthKit authorization requests are timing out with this error. Nothing in my code has changed, but I recently switched Xcode over to a new Apple ID account.
I have a development team setup, a provisioning profile configured, and the HealthKit Capability and Entitlement working. My app builds and runs fine, but any time I make a requestAuthorization
call, I get a timeout for no apparent reason. There's no additional information in the error, and everything appears to be configured properly, so I'm pretty lost on what could cause this.
I've tried both simulators and devices with the same issue. The dialog for HealthKit auth never appears. I can go into the Health app after the fact and turn on the necessary data sharing, but this is a not an acceptable workaround.
What can cause healthKitStore requestAuthorization timeout errors?
I am 99% sure this is a configuration issue, but having gone through the process multiple times, and re-created numerous certs, provisioning profiles etc, I don't know what the problem could be. Where should I be looking for config issues? There is essentially zero documentation on this, and I've only found 2 results on Google related to this with no solutions.
let healthKitTypesToRead = [...]
let healthKitStore:HKHealthStore = HKHealthStore()
healthKitStore.requestAuthorization(toShare: nil, read: healthKitTypesToRead) { (success, error) -> Void in
if( completion != nil ) {
completion(success, error as? NSError)
}
}
ios health-kit
All of my HealthKit authorization requests are timing out with this error. Nothing in my code has changed, but I recently switched Xcode over to a new Apple ID account.
I have a development team setup, a provisioning profile configured, and the HealthKit Capability and Entitlement working. My app builds and runs fine, but any time I make a requestAuthorization
call, I get a timeout for no apparent reason. There's no additional information in the error, and everything appears to be configured properly, so I'm pretty lost on what could cause this.
I've tried both simulators and devices with the same issue. The dialog for HealthKit auth never appears. I can go into the Health app after the fact and turn on the necessary data sharing, but this is a not an acceptable workaround.
What can cause healthKitStore requestAuthorization timeout errors?
I am 99% sure this is a configuration issue, but having gone through the process multiple times, and re-created numerous certs, provisioning profiles etc, I don't know what the problem could be. Where should I be looking for config issues? There is essentially zero documentation on this, and I've only found 2 results on Google related to this with no solutions.
let healthKitTypesToRead = [...]
let healthKitStore:HKHealthStore = HKHealthStore()
healthKitStore.requestAuthorization(toShare: nil, read: healthKitTypesToRead) { (success, error) -> Void in
if( completion != nil ) {
completion(success, error as? NSError)
}
}
ios health-kit
ios health-kit
edited Jan 2 at 23:45
123
asked Dec 29 '18 at 18:48
123123
5,35873462
5,35873462
1
Do you run the requestAuthorization in the main thread?
– Christos Koninis
Jan 9 at 8:19
add a comment |
1
Do you run the requestAuthorization in the main thread?
– Christos Koninis
Jan 9 at 8:19
1
1
Do you run the requestAuthorization in the main thread?
– Christos Koninis
Jan 9 at 8:19
Do you run the requestAuthorization in the main thread?
– Christos Koninis
Jan 9 at 8:19
add a comment |
1 Answer
1
active
oldest
votes
This was due to running the authorization request in a background thread. Doing it on the main thread solved the problem.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53972419%2fhealthkit-requestauthorization-returns-code-100-authorization-session-timed-ou%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This was due to running the authorization request in a background thread. Doing it on the main thread solved the problem.
add a comment |
This was due to running the authorization request in a background thread. Doing it on the main thread solved the problem.
add a comment |
This was due to running the authorization request in a background thread. Doing it on the main thread solved the problem.
This was due to running the authorization request in a background thread. Doing it on the main thread solved the problem.
answered Jan 9 at 21:06
123123
5,35873462
5,35873462
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53972419%2fhealthkit-requestauthorization-returns-code-100-authorization-session-timed-ou%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Do you run the requestAuthorization in the main thread?
– Christos Koninis
Jan 9 at 8:19