Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

App crash after registerForPushNotifications on iOS - FIRInstanceID setAPNSToken:type:
Started by GBF Comm Sep 05 2018 06:53 AM

8 replies to this topic
notification v2 ios fcm firebase cloud messaging issue crash firinstanceid setapnstoken:type: nsinvalidargumentexception
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

GBF Comm

[GLOBAL: userInfoPane.html]
GBF Comm
  • Enthusiast

  • 32 posts
  • Corona SDK

Hello Rob and all the coronalabs community, 
 
I tried to return the problem in all directions before posting here but I have not managed to solve my problem.
We have developed a suite of applications (one for each city) that is still based on the same model and that worked well until then.
For notifications, we use the V2 notification plugin with Firebase Cloud Messaging and it worked very well so far.
 
 
But today we encounter a problem on our apps that we have recently builded (with 2018.3363), only on iOS (it work on Android).
Once on the iOS device, the applications closes at boot time, as soon as it tries to registerForPushNotifications.
 
 
local function notificationListener( event )
...
end


Runtime:addEventListener( "notification", notificationListener ) 


notifications.registerForPushNotifications({ useFCM=true })
 
 
We have this error apparently:
 
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FIRInstanceID setAPNSToken:type:]
: unrecognized selector sent to instance 0x1c40b81e0
 
However, we followed our usual process for the management of Firebase accounts and for the creation of various necessary keys (Firebase, APNs, GoogleService-Info.plist ...).
In short, we do not understand where the problem come from ... and a little help would be appreciated. Someone would know where the mistake can come from? Did we do something wrong? Is this a possible bug?
 
Thank you in advance for all future help you can bring me.
Have a nice day!
 
PS: Sorry for my bad english


[TOPIC: post.html]
#2

GBF Comm

[GLOBAL: userInfoPane.html]
GBF Comm
  • Enthusiast

  • 32 posts
  • Corona SDK

Hello community,
 
I allow myself to post again because we still have not found an answer to our problem, and our client may lose patience.
We have downloaded the latest Corona daily build, updated Xcode and retried to build and the result is still the same.
 
Has Apple changed anything on its side with the upcoming arrival of iOS 12?
Has anyone encountered the same problem ... and maybe found a solution? 
 
The problem does not seem to concern only our latest new application.
 
We tried to build again our old applications that worked perfectly until then (created on the same model) and we also meet the same problem.
 
Thank you very much for the help you can give me.


[TOPIC: post.html]
#3

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,535 posts
  • Corona Staff

Can you put together a sample project that demonstrates the problem and use the Report a Bug feature at the top of the screen.

 

It needs to be a project that our engineers can build and run on a device, so provide a main.lua, config.lua, build.settings and other necessary files in a .zip file along with details on how to setup and run the project.

 

Thanks

Rob



[TOPIC: post.html]
#4

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 507 posts
  • Corona SDK

I have been unable to release my new app due to this problem. I thought this was related to the firebase.analytics plugin, but after disabling that, the notification does exit the app immediate after bringing up the ALLOW or DISALLOW dialog. Imagine that the allow or disallow dialog comes up and then behind it, your app closes. Makes no sense.



[TOPIC: post.html]
#5

troylyndon

[GLOBAL: userInfoPane.html]
troylyndon
  • Contributor

  • 507 posts
  • Corona SDK

FYI, I'm using build 3366 (3 versions newer from GBF Comm)



[TOPIC: post.html]
#6

GBF Comm

[GLOBAL: userInfoPane.html]
GBF Comm
  • Enthusiast

  • 32 posts
  • Corona SDK

Hello Rob, Bektur, troylyndon and community!
 
We submitted the bug report with a sample code leaving only V2 notification and FirebaseAnalytics. We had a feedback saying to try without the Scott Harrison firebase Analytics plugin. We have indeed tried without this plugin and it works. No more crash! and the the ALLOW or DISALLOW dialog works.
 
So it looks like Scott Harrison's Firebase Analytics plugin is causing the problem and crashing at notifications.registerForPushNotifications ({useFCM = true}).
 
We already had a problem of cohabitation of the two plugin. We understood that it was imperative to perform the initialization of Analytics firebase a few seconds after the call to notifications. So with a timer.performWithDelay everything worked until then.
 
Apparently this does not work anymore and we must now find how to succeed in making both plugins live together.
would anyone have an idea? do you know if scott Harrison is actively following the Corona forums?
 
This is two major plugin for Corona and the fact that it can no longer cohabit together is really a problem for us. :(


[TOPIC: post.html]
#7

GBF Comm

[GLOBAL: userInfoPane.html]
GBF Comm
  • Enthusiast

  • 32 posts
  • Corona SDK

Hello,
I continued my tests and I arrived at this observation:
By cleaning any call to Firebase Analytics in my .lua files but leaving only the call to the plugin in the build.settings we have the crash.

plugins =
    {
        
        ["plugin.firebaseAnalytics"] = {
          publisherId = "tech.scotth",
        },
        ["plugin.notifications.v2"] =
        {
            publisherId = "com.coronalabs",
        },


    },

 

 

Apparently, The problem does not come from our code but an incompatibility between the two plugins during compilation.

 

 

 

 

@Scott Harrison please help!



[TOPIC: post.html]
#8

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,535 posts
  • Corona Staff

@troylyndon, @GBF Comm,

 

I'm kind of confused now. Troy you say removing the Analytics plugin causes the app to still crash. @GBF you say removing the Analytics plugin solves the problem. 

 

@troylyndon do you have a sample app that demos this crash? (stripped down app). If you do, it might be worth the two of you sharing each other's test case and get independent verification. Maybe it will help narrow down what the difference is between your two experiences.

 

The only one who can address problems with Scott's plugins is Scott. I can't speak to how much he monitors the forums, but the marketplace should have contact information for him as well as his support channels. It's best you reach out directly to him. 

 

Rob



[TOPIC: post.html]
#9

GBF Comm

[GLOBAL: userInfoPane.html]
GBF Comm
  • Enthusiast

  • 32 posts
  • Corona SDK

@Rob Miracle.

 

Yes, totally removing the Analytics plugin solves the problem. As i said before in my previous post, juste leaving the declaration in Build.settings cause the crash. Perhaps troylyndon doesn't remove the plugin decalaration in the build.settings? Do you troylyndon?

 

I sent to scott harrison a mail with sample files to reproduce the problem. It only remains for me to wait for his answer. I will keep you informed on this topic of the continuation and, I hope, of the resolution of the problem.

 

Thanks
GBF Comm




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: notification v2, ios, fcm, firebase cloud messaging, issue, crash, firinstanceid, setapnstoken:type:, nsinvalidargumentexception