ibm-bluemix-mobile-services/bms-clientsdk-swift-push

Sample project utilises features which require an advanced plan

Closed this issue · 4 comments

The JSON object which is sent by default when calling registerWithDeviceToken is the following:

{
"deviceId": "XXXXX-XXXX-XXXX-XXX-XXXX",
"token": "XXXXXXXX",
"platform": "A",
"variables": {}
}

This results in the following error:
Error during device registration - Error code is: 405 and error is: Optional("{\"code\":\"FPWSE0036E\",\"message\":\"The application \'XXXX-XXX-XXX-XXXX-XXXXXX\' is not enabled for the plan. Please upgrade to Advanced plan.\"}")

Removing the variables field causes the registration to succeed.

I believe that the variables field is set via: parameterized notifications, but this is not documented in the API.

I feel like there should not be a requirement to use the advanced plan just to utilise the sample app.

@Heysunk Hi , It is not mandatory to use the variables in the registration. The documentation for parameterized push are -
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-push#parameterize-push-notifications

let variables = ["username":"ananth","accountNumber":"3564758697057869"]

It is

Hi.

Yes, I came to realise that. The thing is, I'm not using them. When I initialize the BMSPushClient.sharedInstance I utilize the following code.

   // push.initializeWithAppGUID(appGUID: pushAppGUID, clientSecret: pushClientSecret, options: pushNotificationOptions)  
  push.initializeWithAppGUID(appGUID: pushAppGUID, clientSecret: pushClientSecret)

Yet, when I try to register the token via the didRegisterForRemoteNotificationsWithDeviceTokencallback it still sends an empty variable field as seen in my original post.

Perhaps this is an issue with BMSPush itself?

@Heysunk Delete the app from the iphone simulator or iphone . Then reinstall it as a new app. That might solve your issue .

Deleting the app solved the issue. It seems that setting the push variables is persistent across app restarts and deleting the app reset these variables.

Thank you for your help.