HealthKit requestAuthorization returns code 100: “Authorization session timed out”












0















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)
}
}









share|improve this question




















  • 1





    Do you run the requestAuthorization in the main thread?

    – Christos Koninis
    Jan 9 at 8:19
















0















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)
}
}









share|improve this question




















  • 1





    Do you run the requestAuthorization in the main thread?

    – Christos Koninis
    Jan 9 at 8:19














0












0








0








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)
}
}









share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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














  • 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












1 Answer
1






active

oldest

votes


















0














This was due to running the authorization request in a background thread. Doing it on the main thread solved the problem.






share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0














    This was due to running the authorization request in a background thread. Doing it on the main thread solved the problem.






    share|improve this answer




























      0














      This was due to running the authorization request in a background thread. Doing it on the main thread solved the problem.






      share|improve this answer


























        0












        0








        0







        This was due to running the authorization request in a background thread. Doing it on the main thread solved the problem.






        share|improve this answer













        This was due to running the authorization request in a background thread. Doing it on the main thread solved the problem.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 9 at 21:06









        123123

        5,35873462




        5,35873462






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas