Mobile First - Unable to Register Device for Push Notification - ios

It seems i am not able to register my iOS device on a remote server(MobileFirst Platform Server) that is being hosted for push notification.
Here is my code for registering the device
MFPPush.registerDevice(
{},function(successResponse) {
},
function(failureResponse) {
alert("Failed to register "+failureResponse);
});
I'm always getting a fail response which is
"Error Domain=com.ibm.mfp.push Code=5 \"Request failed: internal server error (500)\" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x156663e80> { URL: http://<server-ip:port>/imfpush/v1/apps/<app-bundleidentifier>/devices/FFF2867D-D43A-4FC0-A9C7-CBECF26BFFD6 } { status code: 500, headers {
Connection = Close;
\"Content-Length\" = 0;
\"Content-Type\" = \"application/json\";
Date = \"Mon, 20 Mar 2017 03:57:45 GMT\";
\"X-Powered-By\" = \"Servlet/3.0\";
}}, NSErrorFailingURLKey=http://<server-ip:port>/imfpush/v1/apps/<app-bundleidentifier>/devices/FFF2867D-D43A-4FC0-A9C7-CBECF26BFFD6, com.alamofire.serialization.response.error.data=<>, NSLocalizedDescription=Request failed: internal server error (500)}"
Other information:
My server ip is http://52..:9080
I have set up "push.mobileclient" scope with custom security check, i have also set up "push.application.app-bundleidentifier" and "messages.write" at Confidential Clients
I have uploaded the apns-certificate-sandbox.p12 cert too for the app for MobileFirst server
The registration is successful when I'm registering against localhost.
I hope the data provided is sufficient.
thanks in advance

I have manage to solve this by updating the server and client mobile first platform version to the same one.

Related

Trouble receiving notifications from iTunes Connect about IAP status change events

I've set up a URL on my server to receive auto-renewable IAP status change notifications per this article:
https://help.apple.com/itunes-connect/developer/#/dev0067a330b
And of course I've provided my URL to iTunes Connect via my app's main settings page.
However, I'm receiving neither update notifications nor any kind of message indicating that there's a problem.
Help troubleshooting? I don't even know where to start.
Thanks!
Have you checked secure network connection with your server? I mean that you have to check ATS on your server. I'm using nginx such as proxy server. First of all, you have to check your nginx system pair past with ATS to connect with apple server.
This method to check ATS pass on nginx server
nscurl --ats-diagnostics <your status receive url>
See more on apple documentation Using the nscurl Tool to Diagnose ATS Connection Issues
If your server passed. You are ready to receive response from apple.
My subscription status URL setup simple such as a simple http service created on nodejs ( express framwork )
const express = require('express')
const app = express()
const bodyParser = require('body-parser');
const path = require('path');
process.on('uncaughtException', function (err) {
console.log(err.stack);
});
process.on('exit', function (code) {
console.log('About to exit with code: ' + code);
});
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())
app.post('/', function (req, res) {
console.log(req.body); < response from apple is here >
res.send({ ok: 1 });
})
const port = 12092;
app.listen(port, function () {
console.log('Subscription status url ping on port ' + port);
});
By the way, you should update your question. you can reference from a other relation question on your question. This's more helpful!.

SocketIOClient- Swift : Unable to authenticate socket server

I am passing authentication token parameter like below...
socket = SocketIOClient(socketURL: URL(string:"http://localhost:3001")!, config: [.log(true), .forcePolling(true),.connectParams(["Authorisation": kToken])])
But it always gives an error....
LOG SocketParser: Decoded packet as: SocketPacket {type: 2; data: [login_ack, {
message = "InValid Token";
result = "";
status = error;
}]; id: -1; placeholders: -1; nsp: /}
As I think that I am missing some thing to establish authenticated socket connection. So, please guide me where I am lacking.
I have resolved it by my self!
It was the issue from back end team. They were put some dependencies with the socket call back sender device information details which they are taking from the socket call backs. And the actual problem was ,all the devices and computers were providing their device details but iOS was not giving it from their end with their security protection.So,their validity condition were not satisfying for iOS socket call backs.
Backend team handled this situation by putting "Other" device type checking at their end.

IBM-Bluemix Push Service on iOS crashes app when first registering with the service

I'm using the new push-notification service on bluemix, with an iOS device.
The device registers successfully. When I check with the REST-API, I see the device-ID, token and so on.
However, running the iOS-app on the device crashes the app on first run and registration.
The crash happens in CDVMFPPush.swift in func didRegisterForRemoteNotifications(deviceToken: NSData)
on line 309 (let pushToken = response.responseJson["token"] as! String).
I did a print(response) in this function and it seems that responseJson only contains the deviceId and the userId. The token is missing.
When I use the REST-Api again to do the same request, the response seems to be complete.
I think that because of this error the push registration doesn't finish, as I don't receive any notifications when I try to run the service in sandbox-mode.
Any ideas?
(P.S. I checked this solution - iOS Application crashes when trying to register the device to IBM Mobile First Push service on Bluemix - the linker flag is set [-ObjC])
Here's the request from my console (app-id/secret/device is edited)
Response text: {"createdTime":"2016-06-07T15:28:55Z","lastUpdatedTime":"2016-06-07T15:28:55Z","createdMode":"API","deviceId":"xxxx","userId":"","token":"xxxx","platform":"A","href":"https://myapp.mybluemix.net:443/imfpush/v1/apps/xxxx/devices/xxxx"}
httpStatus: 201
responseHeaders: {
Connection = "Keep-Alive";
"Content-Type" = "application/json";
Date = "Tue, 07 Jun 2016 15:28:55 GMT";
Location = "https://myapp.mybluemix.net:443/imfpush/v1/apps/xxxx/devices/xxxx";
"Transfer-Encoding" = Identity;
"X-Backside-Transport" = "OK OK";
"X-Global-Transaction-ID" = xxxx;
"X-Powered-By" = "Servlet/3.0";
}
responseJson: {
deviceId = "xxxxx";
userId = "";
}
We've updated the MFPPush iOS Framework to resolve the issue and the MFPPush Cordova Plugin has been updated to incorporate these fixes. We suspect the crashes were caused by the fact that you were being sent a second IMFResponse object through the callback and this second IMFResponse's responseJson didn't have the token as you saw which was resulting in the crash. These changes should resolve that issue.
Easiest way to update the plugin is just to remove the old and re-add it, you should be on version 1.0.14 of ibm-mfp-push to see the fixes.
Can see the update on the related Github as of this morning as well
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-cordova-plugin-push

How to configure Push Notification in Mobile App Buider?

I'm using a Mobile App Builder to make some prototype. One of them I need to send push notification. So, I created a App with App Builder and configure a push settings using Push Notification Services (App GUID and App Route).
After that, I was defined settings a Apple Certificate to send push (https://new-console.ng.bluemix.net/docs/services/mobilepush/t_push_provider_ios.html)
So, when I try to send push notification using Push Notification Services (Bluemix) I receive a msg:
1 - Internal server error. No devices found.
When I see a log in XCode I Found:
registerDeviceToken:completionHandler:]_block_invoke_2 in IMFPushClient.m:116 :: Response of device registration - Response is: httpStatus: 201
responseHeaders: {
Connection = "Keep-Alive";
"Content-Type" = "application/json";
Date = "Thu, 12 May 2016 18:21:22 GMT";
Location = "https://enviarpush.mybluemix.net:443/imfpush/v1/apps/428e6b13-2cc7-4f99-8d7e-9741d6742709/devices/AFAF9994-535D-4F6C-9789-317E680833A8";
"Transfer-Encoding" = Identity;
"X-Backside-Transport" = "OK OK";
"X-Global-Transaction-ID" = 2301423703;
"X-Powered-By" = "Servlet/3.0";
}
responseJson: {
createdMode = API;
createdTime = "2016-05-12T18:21:22Z";
deviceId = "AFAF9994-535D-4F6C-9789-317E680833A8";
href = "https://enviarpush.mybluemix.net:443/imfpush/v1/apps/428e6b13-2cc7-4f99-8d7e-9741d6742709/devices/AFAF9994-535D-4F6C-9789-317E680833A8";
lastUpdatedTime = "2016-05-12T18:21:22Z";
platform = A;
token = 7574a3f1d14a7a01f8d43663cef686b3cb66a634b71ed20608a739c4f55356db;
userId = "";
}
Response text: {"createdTime":"2016-05-12T18:21:22Z","lastUpdatedTime":"2016-05-12T18:21:22Z","createdMode":"API","deviceId":"AFAF9994-535D-4F6C-9789-317E680833A8","userId":"","token":"7574a3f1d14a7a01f8d43663cef686b3cb66a634b71ed20608a739c4f55356db","platform":"A","href":"https://enviarpush.mybluemix.net:443/imfpush/v1/apps/428e6b13-2cc7-4f99-8d7e-9741d6742709/devices/AFAF9994-535D-4F6C-9789-317E680833A8"}
This infos confirm that my device was register, I'm right?
Thanks
Moving forward we will be integrating the device registration, for the period we are experimental we will be creating a number of blog posts that explain some of the key integration you will need to do manually in code. This will include how we recommend integrating with a bluemix backend.
You have to register a device to the IBM Push Notifications Service in order for it to successfully receive push notifications. I would suggest looking at the following documentation:
Enabling iOS applications to receive push notifications
There is also a sample available that demonstrates these capabilities:
HelloPush

IOS app failed to connect with sails.js server through socket.io(SIOSocket)

I'm trying to build a IOS application like MegaBits/WorldPin(https://github.com/MegaBits/WorldPin.git). The different is i used a sails on server. I failed to connect with my server .
in IOS client the code is :
[SIOSocket socketWithHost: #"http://localhost:1339" response: ^(SIOSocket *socket){
self.socketIO = socket;
socket.onConnect = ^()
{
NSLog(#"somebody onConnect");
self.isConnected = YES;
};
}
Did i missing something? how can i connect with a sails server in IOS using SIOSocket.
Use your IP address instead of localhost.

Resources