At first, sorry for lack of information in the first post.
Everything works fine in iOs 7, in that os our application shows up in the list of applications that uses push notifications, but that is not the case in iOs 8.
I assume that certificates and such is correct, since it is working in iOs 7.
The core of the registration process is, which also assume is correct since it works for iOs 7 as well as for Android.
EDIT::: You were right, we are getting an error:
\<Warning\>: registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.
local function onNotification( event ) if event.type == "remoteRegistration" then local PushToken = event.token \_G.deviceId = event.token . . . Runtime:addEventListener( "notification", onNotification )
And this is the php-function that is sending the notifications.
We are getting “‘Connected to APNS’” and “‘Message successfully delivered’” as result, so there should not be any problem with connecting to apple server and such.
function send\_ios($alert,$message,$action,$id,$silentMode,$iosSound) { $passphrase = 'xxx'; $ctx = stream\_context\_create(); stream\_context\_set\_option($ctx, 'ssl', 'local\_cert', 'ck\_prod.pem'); stream\_context\_set\_option($ctx, 'ssl', 'passphrase', $passphrase); $fp = stream\_socket\_client( 'ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM\_CLIENT\_CONNECT|STREAM\_CLIENT\_PERSISTENT, $ctx); if (!$fp) exit("Failed to connect: $err $errstr" . PHP\_EOL); echo 'Connected to APNS' . PHP\_EOL; if($silentMode==true) { $body['aps'] = array( 'content-available' =\> 1, 'sound' =\> '' ); echo "silent for real"; } else { $sound = 'sound/ding.mp3'; if($iosSound==false) { $sound = ''; } // Create the payload body $body['aps'] = array( 'alert' =\> $alert, 'badge' =\> 0, 'sound' =\> $sound ); } $body['custom'] = array('action' =\> $action,'message' =\> $message); $payload = json\_encode($body); $msg = chr(0) . pack('n', 32) . pack('H\*', $id) . pack('n', strlen($payload)) . $payload; echo strlen($msg); // Send it to the server $result = fwrite($fp, $msg, strlen($msg)); if (!$result) echo 'Message not delivered' . PHP\_EOL; else echo 'Message successfully delivered' . PHP\_EOL; // Close the connection to the server fclose($fp); return $result; }
In the config files we are asking for notification permission for iOs.
if string.sub(system.getInfo("model"),1,2) == "iP" then application = { notification = { iphone = { types = { "badge", "sound", "alert" }, },
And at last in the build.settings file we do have:
iphone = { plist = { UIApplicationExitsOnSuspend = false, CFBundleShortVersionString = "6.0", FacebookAppID = "OUR APP ID", CFBundleURLTypes = { { -- This set of braces is important! CFBundleURLSchemes = { "fb OUR APP ID", } } }, CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, }, },
And as mentioned we have the Build: 2014.2393.
Thank you for helping, and just write back if any information is missing.