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!

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:

Glad to hear your up and running. Also nice to hear that you like the new action buttons feature too.

Let us know if you have any more questions or suggestions for GameThrive.

Hi Josh,

Ok, so I created a brand new app in the portal.  I reset my push stuff on my phone to get a clean start and then did the following:

  1. Freshly installed my app

  2. Loaded my app but didnt go to the screen where is asks for the permission,

  3.  at this point i look at gamethrive portal and i can see a new user has been created (but no subscribed)

  4. Check my logs and can see the playerid call back has been called - all ok - as you said, player id but no push token yet

  5. I now go to my screen where i’ll be prompted for push notifications - I choose yes

  6. I now expect a second call to the playerid call back but it never happened.  I got the registered with apple and gamethrive log messages but thats it.

Can you confirm it should be working as I expect?

I have this in my main.lua

function IdsAvailable(playerID, pushToken) print("GameThrive: PLAYER\_ID:" .. playerID) settings.gtPlayerId = playerID if pushToken then -- nil if user did not accept push notifications on iOS print("PUSH\_TOKEN:" .. pushToken) settings.pushToken = pushToken end settings:save() end GameThrive.DisableAutoRegister() GameThrive.Init(glo.push.gameThriveKey, glo.push.googleProjId, DidReceiveRemoteNotification) &nbsp; &nbsp; GameThrive.IdsAvailableCallback(IdsAvailable) -- this gets the ID but no push token

and then in another scene - scene1.lua i have this:

 local function regNotification( event ) if "clicked" == event.action then settings.push = true settings:save() GameThrive.RegisterForNotifications() end end if settings.push ~= true then native.showAlert( "Alerts", "For the best game experience, we can send you a notification when it's your turn.\n\n If this is ok, please touch allow on the next alert.", { "OK" }, regNotification ) end

Do you think it is because the id callback is in main? its a global function so it should work i tink

Thanks

Dave

(I also sent myself a test push from the portal and I recieved it ok)

Dave,

I just looked over our code that binds the lua callback to our Objective-c library and just saw it unbinds it after the first call. Sorry about this issue, we are planning on making a small update on Tuesday and can get a fix for this in there too.

Thanks.

Hey Dave,

Just pushed GameThrive SDK v1.4.4 with the IdsAvailable fix and should be available in the next 2 or 3 hours. You can check for the version number in the terminal before you build or in Xcode after it is running on the device.

Thanks.