Closed SeanJD closed 8 years ago
I'm compiling with the ASC 20.0 SDK I've updated the iPhone 4s to iOS 9.2.1 and it's still crashing when a PN comes through (it bings and vibrates at the same time as the app crashing out). I'm not developing on a mac so can't use x-code to view the crash-log
What payload are you sending in the push notification? Are you using a custom JSON or just the simple parse push notification?
It's a simple notification. Both from my cloudcode call (see below) but also if i send a push directly from the Parse dashboard.
Parse.Push.send({ where: installationQuery, data: { alert: message//message is a simple string value } }, { success: function() { }, error: function(error) { } });
I've worked through to the cause of this issue. I was under the impression the app only needed to call the Parse.service.setupApplication and Parse.service.register methods once (on first registering the installation) so had written a command call to only do this once (using persistent data to store it and skip if it's already been successfully registered).
I was always calling Core.init & Parse.init(key) & registering the notification and error handlers.
This seemed to work and the OS would receive notifications but was the cause of it crashing out (on iOS only) when a new PN came through.
I now call the methods Parse.service.setupApplication(ParseConfig.APPLICATION_ID, ParseConfig.CLIENT_KEY, false); Parse.service.register(false); every time the application starts and that has solved it.
My bad, apologies for this, I just thought the above only had to be called when first registering the app/device with Parse/APN/GCM and was a waste to call it every time. Turns out it isn't!
Hopefully this info will come in useful for others making the same mistake in the future.
Hi,
Yes, sorry if that wasn't clear but those functions need to be called each run of your application as they check the setup of your application and load information from memory / storage if required.
I'll make sure this is clear in the documentation.
Cheers.
Hi guys. I'm having the same problem, i.e. my app crashes when launching from clicking a push notification. However my app is crashing as soon as I call setupApplication(), so I don't even get a chance to call register(). The launches fine when I launch normally. Any ideas what I might be doing wrong?
My AS3 code looks like this:
`protected function init( ):void { try { Core.init(); trace("ParseNotificationController:init _appKey = " + _appKey ); Parse.init( _appKey );
trace( "Parse Supported: " + Parse.isSupported );
if (Parse.isSupported)
{
trace( "Parse Version: " + Parse.service.version );
trace("ParseNotificationController:init _parseAppId = " + _parseAppId );
trace("ParseNotificationController:init _parseClientKey = " + _parseClientKey );
Parse.service.addEventListener( ParseEvent.NOTIFICATION, parse_notificationHandler );
Parse.service.addEventListener( ParseEvent.FOREGROUND_NOTIFICATION, parse_notificationHandler );
Parse.service.addEventListener( ParseEvent.BACKGROUND_NOTIFICATION, parse_notificationHandler );
Parse.service.addEventListener( ParseEvent.REGISTERING, parse_printEventHandler );
Parse.service.addEventListener( ParseEvent.REGISTER_SUCCESS, parse_registerHandler );
Parse.service.addEventListener( ParseEvent.UNREGISTERED, parse_printEventHandler );
Parse.service.addEventListener( ParseEvent.ERROR, parse_errorHandler );
trace("ParseNotificationController:init setupApplication" );
Parse.service.setupApplication( _parseAppId, _parseClientKey );
trace("ParseNotificationController:init register" );
Parse.service.register(false);
}
}
catch (e:Error)
{
trace( "ERROR:" + e.message );
}
}
`
Output from xcode is;
@gameaccount Could you start a new issue for this? also make sure you are using the latest version of the Parse and Bolts ANEs. Cheers
I've built my app for iOS and android. Android's fine and behaves as expected but on iOS if the app's open when it receives a PN from Parse then the app crashes/closes. I've tested on an iPhone 4S, iOS 8.3 and an iPhone 5s, iOS 8.4.1. Same thing happens on both. If I receive a PN from another source (i.e. facebook) when the app's open it's fine - the PN slides in over the top of the app, but as soon as it gets one registered to itself it bombs out. It may be that I'm missing something but have gone through the TestParse example and am pretty sure it's set up as should be - also as I say it works fine on regitsering the device/installation and receiving PN's from APN - it's only if the app's open that it crashes. Any ideas?
Thanks