iOS10: I cannot get currentUserNotificationSettings after getting push notification











up vote
3
down vote

favorite
1












I'm developing app using push notification, and I had an issue on only iOS10 devices.



I can get currentUserNotificatoinSettings.types during the first launch.



[UIApplication sharedApplication].currentUserNotificationSettings.types;


But after I got pushNotification, the thread, which read currentUserNotificatoinSettings.types, froze without any exceptions.
Somehow I tried to get exceptions by using @try@catch, breakpointNavigator in Xcode, or Zombies on profiler, but it doesn't show any exceptions.



How should I debug this issue? or does anyone know what the cause of this issue is?










share|improve this question






















  • Are you getting some Exception when iOS decode the payload in push notification?
    – orafaelreis
    Mar 27 '17 at 17:18















up vote
3
down vote

favorite
1












I'm developing app using push notification, and I had an issue on only iOS10 devices.



I can get currentUserNotificatoinSettings.types during the first launch.



[UIApplication sharedApplication].currentUserNotificationSettings.types;


But after I got pushNotification, the thread, which read currentUserNotificatoinSettings.types, froze without any exceptions.
Somehow I tried to get exceptions by using @try@catch, breakpointNavigator in Xcode, or Zombies on profiler, but it doesn't show any exceptions.



How should I debug this issue? or does anyone know what the cause of this issue is?










share|improve this question






















  • Are you getting some Exception when iOS decode the payload in push notification?
    – orafaelreis
    Mar 27 '17 at 17:18













up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





I'm developing app using push notification, and I had an issue on only iOS10 devices.



I can get currentUserNotificatoinSettings.types during the first launch.



[UIApplication sharedApplication].currentUserNotificationSettings.types;


But after I got pushNotification, the thread, which read currentUserNotificatoinSettings.types, froze without any exceptions.
Somehow I tried to get exceptions by using @try@catch, breakpointNavigator in Xcode, or Zombies on profiler, but it doesn't show any exceptions.



How should I debug this issue? or does anyone know what the cause of this issue is?










share|improve this question













I'm developing app using push notification, and I had an issue on only iOS10 devices.



I can get currentUserNotificatoinSettings.types during the first launch.



[UIApplication sharedApplication].currentUserNotificationSettings.types;


But after I got pushNotification, the thread, which read currentUserNotificatoinSettings.types, froze without any exceptions.
Somehow I tried to get exceptions by using @try@catch, breakpointNavigator in Xcode, or Zombies on profiler, but it doesn't show any exceptions.



How should I debug this issue? or does anyone know what the cause of this issue is?







ios objective-c push-notification ios10






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 '17 at 14:08









Y.Okano

161




161












  • Are you getting some Exception when iOS decode the payload in push notification?
    – orafaelreis
    Mar 27 '17 at 17:18


















  • Are you getting some Exception when iOS decode the payload in push notification?
    – orafaelreis
    Mar 27 '17 at 17:18
















Are you getting some Exception when iOS decode the payload in push notification?
– orafaelreis
Mar 27 '17 at 17:18




Are you getting some Exception when iOS decode the payload in push notification?
– orafaelreis
Mar 27 '17 at 17:18












2 Answers
2






active

oldest

votes

















up vote
0
down vote













You should access UIApplication methods only from on main thread. Wrap your code that accesses the notification settings in a dispatch_async(dispatch_get_main_queue(), ….






share|improve this answer























  • Thank you for your answer. but I access currentUserNotificationSettings on main thread and so, my application freeze by it. Strange to say, this issue also happens on [[UIApplication sharedApplication] registerUserNotificationSettings:] method after getting push notification... :(
    – Y.Okano
    Jan 2 '17 at 14:34












  • What do you see in the stack trace? When app is stuck, pause in the debugger and add a screenshot of what can be seen there.
    – Leo Natan
    Jan 2 '17 at 14:35










  • Here's mine: link. The app got frozen on this line after receiving a notification, although it IS a main thread for sure. Do you have any ideas?
    – demon9733
    Dec 8 '17 at 12:34












  • @demon9733 You need to open the stack trace to include the system frames, otherwise it's impossible to know what is going on.
    – Leo Natan
    Dec 8 '17 at 19:25


















up vote
0
down vote













I have just solved same problem on iOS 11.2.6. I provide my system callstak when the app is stuck.
In my case, currentUserNotificationSettings called synchronously on main thread, not asynchronously. So that maybe causes deadlock.
I don't know why this is not occurred in iOS 12. But I hope this can help you. Thanks.






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',
    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%2f41428378%2fios10-i-cannot-get-currentusernotificationsettings-after-getting-push-notificat%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    You should access UIApplication methods only from on main thread. Wrap your code that accesses the notification settings in a dispatch_async(dispatch_get_main_queue(), ….






    share|improve this answer























    • Thank you for your answer. but I access currentUserNotificationSettings on main thread and so, my application freeze by it. Strange to say, this issue also happens on [[UIApplication sharedApplication] registerUserNotificationSettings:] method after getting push notification... :(
      – Y.Okano
      Jan 2 '17 at 14:34












    • What do you see in the stack trace? When app is stuck, pause in the debugger and add a screenshot of what can be seen there.
      – Leo Natan
      Jan 2 '17 at 14:35










    • Here's mine: link. The app got frozen on this line after receiving a notification, although it IS a main thread for sure. Do you have any ideas?
      – demon9733
      Dec 8 '17 at 12:34












    • @demon9733 You need to open the stack trace to include the system frames, otherwise it's impossible to know what is going on.
      – Leo Natan
      Dec 8 '17 at 19:25















    up vote
    0
    down vote













    You should access UIApplication methods only from on main thread. Wrap your code that accesses the notification settings in a dispatch_async(dispatch_get_main_queue(), ….






    share|improve this answer























    • Thank you for your answer. but I access currentUserNotificationSettings on main thread and so, my application freeze by it. Strange to say, this issue also happens on [[UIApplication sharedApplication] registerUserNotificationSettings:] method after getting push notification... :(
      – Y.Okano
      Jan 2 '17 at 14:34












    • What do you see in the stack trace? When app is stuck, pause in the debugger and add a screenshot of what can be seen there.
      – Leo Natan
      Jan 2 '17 at 14:35










    • Here's mine: link. The app got frozen on this line after receiving a notification, although it IS a main thread for sure. Do you have any ideas?
      – demon9733
      Dec 8 '17 at 12:34












    • @demon9733 You need to open the stack trace to include the system frames, otherwise it's impossible to know what is going on.
      – Leo Natan
      Dec 8 '17 at 19:25













    up vote
    0
    down vote










    up vote
    0
    down vote









    You should access UIApplication methods only from on main thread. Wrap your code that accesses the notification settings in a dispatch_async(dispatch_get_main_queue(), ….






    share|improve this answer














    You should access UIApplication methods only from on main thread. Wrap your code that accesses the notification settings in a dispatch_async(dispatch_get_main_queue(), ….







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jan 2 '17 at 14:18

























    answered Jan 2 '17 at 14:12









    Leo Natan

    51.5k8123173




    51.5k8123173












    • Thank you for your answer. but I access currentUserNotificationSettings on main thread and so, my application freeze by it. Strange to say, this issue also happens on [[UIApplication sharedApplication] registerUserNotificationSettings:] method after getting push notification... :(
      – Y.Okano
      Jan 2 '17 at 14:34












    • What do you see in the stack trace? When app is stuck, pause in the debugger and add a screenshot of what can be seen there.
      – Leo Natan
      Jan 2 '17 at 14:35










    • Here's mine: link. The app got frozen on this line after receiving a notification, although it IS a main thread for sure. Do you have any ideas?
      – demon9733
      Dec 8 '17 at 12:34












    • @demon9733 You need to open the stack trace to include the system frames, otherwise it's impossible to know what is going on.
      – Leo Natan
      Dec 8 '17 at 19:25


















    • Thank you for your answer. but I access currentUserNotificationSettings on main thread and so, my application freeze by it. Strange to say, this issue also happens on [[UIApplication sharedApplication] registerUserNotificationSettings:] method after getting push notification... :(
      – Y.Okano
      Jan 2 '17 at 14:34












    • What do you see in the stack trace? When app is stuck, pause in the debugger and add a screenshot of what can be seen there.
      – Leo Natan
      Jan 2 '17 at 14:35










    • Here's mine: link. The app got frozen on this line after receiving a notification, although it IS a main thread for sure. Do you have any ideas?
      – demon9733
      Dec 8 '17 at 12:34












    • @demon9733 You need to open the stack trace to include the system frames, otherwise it's impossible to know what is going on.
      – Leo Natan
      Dec 8 '17 at 19:25
















    Thank you for your answer. but I access currentUserNotificationSettings on main thread and so, my application freeze by it. Strange to say, this issue also happens on [[UIApplication sharedApplication] registerUserNotificationSettings:] method after getting push notification... :(
    – Y.Okano
    Jan 2 '17 at 14:34






    Thank you for your answer. but I access currentUserNotificationSettings on main thread and so, my application freeze by it. Strange to say, this issue also happens on [[UIApplication sharedApplication] registerUserNotificationSettings:] method after getting push notification... :(
    – Y.Okano
    Jan 2 '17 at 14:34














    What do you see in the stack trace? When app is stuck, pause in the debugger and add a screenshot of what can be seen there.
    – Leo Natan
    Jan 2 '17 at 14:35




    What do you see in the stack trace? When app is stuck, pause in the debugger and add a screenshot of what can be seen there.
    – Leo Natan
    Jan 2 '17 at 14:35












    Here's mine: link. The app got frozen on this line after receiving a notification, although it IS a main thread for sure. Do you have any ideas?
    – demon9733
    Dec 8 '17 at 12:34






    Here's mine: link. The app got frozen on this line after receiving a notification, although it IS a main thread for sure. Do you have any ideas?
    – demon9733
    Dec 8 '17 at 12:34














    @demon9733 You need to open the stack trace to include the system frames, otherwise it's impossible to know what is going on.
    – Leo Natan
    Dec 8 '17 at 19:25




    @demon9733 You need to open the stack trace to include the system frames, otherwise it's impossible to know what is going on.
    – Leo Natan
    Dec 8 '17 at 19:25












    up vote
    0
    down vote













    I have just solved same problem on iOS 11.2.6. I provide my system callstak when the app is stuck.
    In my case, currentUserNotificationSettings called synchronously on main thread, not asynchronously. So that maybe causes deadlock.
    I don't know why this is not occurred in iOS 12. But I hope this can help you. Thanks.






    share|improve this answer



























      up vote
      0
      down vote













      I have just solved same problem on iOS 11.2.6. I provide my system callstak when the app is stuck.
      In my case, currentUserNotificationSettings called synchronously on main thread, not asynchronously. So that maybe causes deadlock.
      I don't know why this is not occurred in iOS 12. But I hope this can help you. Thanks.






      share|improve this answer

























        up vote
        0
        down vote










        up vote
        0
        down vote









        I have just solved same problem on iOS 11.2.6. I provide my system callstak when the app is stuck.
        In my case, currentUserNotificationSettings called synchronously on main thread, not asynchronously. So that maybe causes deadlock.
        I don't know why this is not occurred in iOS 12. But I hope this can help you. Thanks.






        share|improve this answer














        I have just solved same problem on iOS 11.2.6. I provide my system callstak when the app is stuck.
        In my case, currentUserNotificationSettings called synchronously on main thread, not asynchronously. So that maybe causes deadlock.
        I don't know why this is not occurred in iOS 12. But I hope this can help you. Thanks.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 21 at 6:15

























        answered Nov 21 at 5:44









        Samuel Kim

        63




        63






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f41428378%2fios10-i-cannot-get-currentusernotificationsettings-after-getting-push-notificat%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

            Sphinx de Gizeh

            Dijon

            Équipe cycliste