IMPORTANT UPDATE GameThrive SDK 1.4.0

I found a crash issue. Tested iPhone 4 (iOS 7.1) and iPhone 5 (iOS 8).

These are the steps to reproduce:

  1. Put this in main.lua:

[lua]local GameThrive    = require ( “plugin.GameThrivePushNotifications” )

local function DidReceiveRemoteNotification(message, additionalData, isFirstOpen)

    print(“Notification”, message, additionalData, isFirstOpen)

end

GameThrive.Init(“abc123”, “123”, DidReceiveRemoteNotification)

local function onSystemEvent(event)

    if event.type == “applicationSuspend” then

        system.scheduleNotification(2, {alert = “Hey now”}) 

    end

end

Runtime:addEventListener( “system”, onSystemEvent );

[/lua]

  1. Build app, put on device and open it

  2. Agree to notifications <-- Sometimes crashing here, but if not continue to next step

  3. Suspend it

  4. Local notification is shown in 2 seconds

  5. Tap the local notification at top of screen

  6. Crash 100% of the time

Log:

Oct 16 15:52:31 KT-100673-5179 SpringBoard[43] <Warning>: LICreateIconForImage passed NULL CGImageRef image

Oct 16 15:52:31 KT-100673-5179 delayedNotifications[224] <Error>: *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]’

*** First throw call stack:

(0x24b62e3f 0x32210c8b 0x24a83ad3 0x24a838b7 0x1764a9 0x176671 0x282698b5 0x2826d4a7 0x2826ca1b 0x2826c99d 0x28261c83 0x2b2951f9 0x2b2a40e9 0x24b295b5 0x24b28879 0x24b273b3 0x24a75621 0x24a75433 0x2be240a9 0x28060359 0x76883 0x32790aaf)

Oct 16 15:52:31 KT-100673-5179 locationd[63] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0

Oct 16 15:52:31 KT-100673-5179 ReportCrash[225] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)

  1. Agree to notifications <-- Sometimes crashing here, but if not continue to next step

Correction: Its crashing every time on this step. Log: http://pastebin.com/XY0DBzcV

Thanks for the details on the crash. We fix the issue where opening local push notifications would crash the app in 1.4.2. We just pushed it and should be live in 2 to 3 hours. You will see “Starting Corona GameThrive SDK v1.4.2” in the Corona simulator terminal and on the iOS device from Xcode when the new version is live.

Thanks.

When will the Enterprise version be updated?  Do I need to wait until tomorrow (assuming Corona releases a new daily build)?

I just got 2451 / 1.4.1 and now I’ve got the crash on startup :frowning:

I believe the Enterprise plugins get updated with the normal daily builds. You don’t have to wait though as I just uploaded our Enterprise plugin here https://www.dropbox.com/s/mfg84cd76mw0cqr/GameThrive1.4.2_2014.2393.zip?dl=0

Fantastic!  Everything is all good now – thanks for the quick response!

Hi Josh,

I have finally had my app approved in the app store but im having issues with the IdsAvailable callback for some installs. this is what should be happening:

  1. user installs my app

  2. opens app and at which point the following is executed:

    GameThrive.DisableAutoRegister() GameThrive.Init(push.gameThriveKey, push.googleProjId, DidReceiveRemoteNotification)

  3.  at this point a user record is created in the gamethrive  portal (but not subscribed)

  4.  after 30 seconds?  due to disable auto register, my Availableid call back is triggered and I set the player ID.  no push token yet.

  5.  User registers (and I create an entry in my databse with gamethrive player Id) and main screen loads - now I call

    GameThrive.RegisterForNotifications() 

  6. Assuming new user allows push, I get a second call to the playerid with a push token.  At which point I update my database like so:

    function IdsAvailable(playerID, pushToken) print(“GameThrive: PLAYER_ID:” … playerID) settings.gtPlayerId = playerID if pushToken then print(“PUSH_TOKEN:” … pushToken) settings.pushToken = pushToken end settings:save() – if user has been created then update if settings.userID ~= nil then print(“update parse with push info”) mod_user.updateUser() end end

The problem is, in some instances - the IdsAvailable just doesnt get called (I know we’ve had problems with this in the past).  At the very least I should be getting the player id from the initial ‘init’ in step 2 even if later on they dont allow push (if that happened i should see your player id in my db and nil for push token).

Are you aware of any issues at your end?  At the moment more than 50% of my players will not be getting push notifications.  I can see that the init is half happening as there seems to be new users in your portal but they are not subscribed.

Really hope this is any easy one to fix.  Let me know if you need more info,

I’ve tried to replicate this but of course it always works for me!

Cheers

Dave

it doesn’t seem to be specific to any device /  os version…  I have not seen this happen on any android devices but Im barely getting downloads in the play store at the moment…

The app was just approved to the apple app store yesterday so it’s mainly iOS at the moment (but could be android too)

Thanks

nevermind guys, I thinks it something I have done - sorry for wasting your time  :unsure:  i can replicate it now

Hey David,

Glad you figured it out. Could you let us know what fixed your issue was once you know for sure what it was? It would help us help others quicker and help anyone who might search and find this topic.

Thanks.

We just pushed v1.4.3 which includes an iOS 8 updated to correctly report players as not subscribed on our site if they said Don’t Allow to the push permission prompt. Also if users choose to change notification settings in the system settings then the next time they go back to your app gamethrive.com will reflect the change.

@jonjonsson In this update IdsAvailable is now consistent on iOS 7 & 8. If your delaying the prompt it will get called once with just the playerID and again when the prompt is accepted with both IDs. Also fixed a bug in iOS 8 where pushToken would always be populated even when the user pressed NO to the prompt.

Hi,

Im using the delayed request for the permission which is great by the way but is there a way I can easily check if its been checked already?

For example, in a common screen I have the line GameThrive.RegisterForNotifications() which is fine, it pops up the message and if i accept or decline, the next time the line runs and nothing happens which is as id expect

However, I’d like to be able to do something like this:

  1. Check if permission has been asked

  2. if not pop up my own message explaining why im about to ask for the permission,

  3. Call GameThrive.RegisterForNotifications() to get permission pop up

How can I achieve step 1?

Not a show stopper if I can’t do it but would be a nice thing from a user experience perspective

Thanks

Dave

Hello Dave,

You should be able to simply store if you have shown your pop up. If you already have then you can skip both showing it again and calling RegisterForNotifications. Not quite as nice as having it built in to GameThrive but should be easy enough to storage with your other game data.

Let me know if that answers your question or if I am overlooking something.

Thanks.

Hi Josh, 

(assume its josh? I’ve spoken to you before via the game thrive portal i think…)

Thanks for the quick reply.  That’s how I have set it up at the moment.    I was just thinking in the situation that they might uninstall the app and then install it again.  My message would pop up but then the permission one wouldn’t (i think thats how it would work)

But to be honest, that scenario is fairly unlikely and even if it did happen, the user would click ok and that would be it.

Cool - i’ll leave it as it is then : :smiley:

Cheers!

Hey David,

Yup, same guy.

You are correct, a user would get your prompt again if they uninstall then re-install your app as iOS does remember their answer even when your app is uninstalled. However this might only be an issue if the user re-installs your app again in less than 24 hours. I haven’t tested this and a reboot might be required too before iOS itself forgets the answer for your app.

Thanks.

Ok, so its all plugged in and I managed reset the notification message to test… but my  IdsAvailableCallback doesnt seem to be firing once I click on OK for the push notifications permission.

When I press ok, i can see:

Device registered with apple

Device registered with gamethrive

I then expected to see my print statement I have in the call back but nothing appeared

I did see it happen when my app initially started - is that sufficient? will that guid change at all?  

Im running 1.4.3 sdk as I see that in the logs

IdsAvailableCallback tries to give you both playerID and pushToken in one call. If it can’t after 30 seconds after init is called (due disabling auto register or some kind of config or connection issue) it will call your callback with just the playerID. Once the device is registered for push notifications it will get called a 2nd time with both ids. Once you get both ids it won’t be called again since it isn’t possible for the ids to change while the app is running so you shouldn’t have to worry about that.

This means that if your app registered correctly with Apple then the next time your app is run from a cold start IdsAvailableCallback will be called with both ids and only once.

Does that makes sense?

We will update or documentation to explain these cases better. Also we can change the output to say “already registered” so it isn’t confusing too.

Thanks jkasten, Interactive Notifications with Action Buttons sounds amazing :smiley:  

EDIT: I was using the wrong  project number on GameThrive.Init() sorry :stuck_out_tongue:

I have a problem. I’m using plugin v1.4.3 with Corona 2014.2393. In my GameThrive account I can see my device subsribed when I open the app, but then is unsubscribed inmmediately. So I cannot send messages. Is this a known bug? Or there is something I could be doing wrong?

From looking at our sever it looks like GCM is reporting your devices as NotRegistered when you send a push notification which is then marking them as unsubscribed. So if you kill your app and re-open it does it shows up a subscribed again? If you try sending anther push does it get unsubscribed again?

If so can you try our example project to see if you have the same issue? https://github.com/GameThrive/GameThrive-Corona-SDK-Push-Notification-Plugin-Sample

Just update the GameThrive.Init() line with your id and Google project number before building.

If that has the same issue can you send a full logcat of the app start up on the device? There might be some errors or warns in there. You can send it to contact@gamethrive.com.

Thanks.

@jkasten thanks for the fast reply, it was my mistake. It works great now,  interactive notifications with action buttons look great :smiley: