Urban Airship : Push Notification with Phonegap not working - ios

Can you please tell me what i am missing
I am using phone gap to develop hybrid APP.
My config.xml looks like
<preference name=“com.urbanairship.developmentappkey” value=“*******RhKiHsW9pASskA ” />
<preference name=“com.urbanairship.developmentappsecret” value=“****2QDjOZJM1g ” />
<preference name=“com.urbanairship.inproduction” value=“No” />
when i build app using XCODE then in console following info is been logged
1.278017ms
2014-06-26 20:09:57.793 Mercer Select[745:60b] [W] -[UAConfig validate] [Line 152] Development App Key is not valid.
2014-06-26 20:09:57.794 Mercer Select[745:60b] [W] -[UAConfig validate] [Line 156] Development App Secret is not valid.
2014-06-26 20:09:57.795 Mercer Select[745:60b] [W] -[UAConfig validate] [Line 160] Production App Key is not valid.
2014-06-26 20:09:57.796 Mercer Select[745:60b] [W] -[UAConfig validate] [Line 164] Production App Secret is not valid.
2014-06-26 20:09:57.797 Mercer Select[745:60b] [E] -[UAConfig validate] [Line 168] Current App Key (***RhKiHsW9pASskA ) is not valid.
2014-06-26 20:09:57.798 Mercer Select[745:60b] [E] -[UAConfig validate] [Line 173] Current App Secret (****2Q_DjOZJM1g ) is not valid.
2014-06-26 20:09:57.799 Mercer Select[745:60b] [E] +[UAirship executeUnsafeTakeOff:] [Line 141] The AirshipConfig.plist file is missing and no application credentials were specified at runtime.
My JS Code look like : I am writing below code inside device.ready event
document.addEventListener("urbanairship.registration", function (event) {
alert("Inside");
if (event.error) {
alert('there was an error registering for push notifications');
} else {
alert("Registered with ID: " + event.pushID);
}
}, false);
document.addEventListener("urbanairship.push", function (event) {
alert("Incoming push: " + event.message);
}, false);

Related

Certificate pinning failing in iOS

We are developing an application using IBM MobileFirst Platform Foundation v7.1. Currently we are in UAT phase. The app supports both Android and iOS.
We implemented certificate pinning for our application. The MobileFirst Server is maintained by the network team, which provided me with a public certificate with "cer" extension (com.uat.myapp.cer). I included this public certificate in my project under the certificate folder and wrote the certificate pinning code in the main.js file.
The Android application is working fine and SSL Handshake with the MobileFirst Server is happening. The application is working properly.
The iOS application though is not able to connect to the MobileFirst Server with the following error:
An SSL error has occurred and a secure connection to the server cannot be made".
I converted the .cer certificate to .der certificate (com.uat.myapp.der) using the following portal: https://www.sslshopper.com/ssl-converter.html and placed it in the application but I still ended up with the same error.
Please find the below error logs for more information:
-[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:390 :: Response Error : An SSL error has occurred and a secure connection to the server cannot be made. 2016-12-26 19:38:49.301 MyApp[1419:26347] [DEBUG] [WORKLIGHT]
+[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/05/28 17:08:17
-[WLRequest requestFailed:error:] in WLRequest.m:509 :: Status code='0' error='An SSL error has occurred and a secure connection to the server cannot be made.' response='(null)'
2016-12-26 19:38:49.302 MyApp[1419:26347] [DEBUG] [WL_REQUEST]
-[WLRequest requestFailed:error:] in WLRequest.m:512 :: Response Header: (null) Response Data: (null)
2016-12-26 19:38:49.302 MyApp[1419:26347] [DEBUG] [WL_AUTH]
-[WLAuthorizationManager failRegistratioWithResponse:] in WLAuthorizationManager.m:866 :: Response does not contain a valid certificate and client Id. device registration failed
2016-12-26 19:38:49.306 MyApp[1419:26347] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager removeKey:] in WLCertManager.m:262 :: Key was successfully removed.
My hunch is that the domain specified in the certificate does not match the actual server host or IP used by the application.
Use keytool verify that the certificate indeed contains the required host/ip values.
In your application, make sure that the application indeed attempts to connect to the same server host/ip.

MFP connection getting error in ios

I am unable to connect MFP in ios i'm getting the error like this.
Response Data: /*-secure-{"reason":"App authenticity security check failed"}*/
2016-10-10 10:53:56.293 appname[3983:433885] [DEBUG] [WL_AUTH] -[WLAuthorizationManager failRegistratioWithResponse:] in WLAuthorizationManager.m:846 :: Response does
not contain a valid certificate and client Id. device registration failed
2016-10-10 10:53:56.295 appname[3983:433885] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager removeKey:] in WLCertManager.m:261 :: Key was successfully remove
MFP version 7.1.0.00.20150807-0630
Upgrade your server and studio installations to the latest iFix release from IBM Fix Central, currently at 7.1.0.0-MFPF-IF201610060540 as many authenticity-related issues have been resolved
Authenticity errors may happen if you incorrectly setup authenticity
You forgot to add the bundleId and applicationId to the application-descriptor.xml file
You're using a different bundleId value than your actual bundleId value for the iOS application
For instructions: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/authentication-security/application-authenticity-protection/

IBM MobileFirst 7.1 - /authorization/v1/clients/instance - 404 Not Found

I have developed a MobileFirst 7.1 Hybrid application in eclipse with ipad environment.
This ipad environment is configured with a custom security test that has the following realm:
<customSecurityTest name="myIpadTest">
<test isInternalUserID="true" realm="wl_anonymousUserRealm" />
<test realm="wl_deviceNoProvisioningRealm" isInternalUserID="true" />
</customSecurityTest>
In the application-descriptor.xml
<ipad bundleId="com.xxx.xxx.xxx" securityTest="myIpadTest" version="1.0">
....
</ipad>
This application when installed in the real device works properly with my Eclipse environment and my Staging MobileFirst Server. The Staging MobileFirst Server has HTTP Server Nginx in front of it without SSL.
But when I deploy the same application in the Production MobileFirst Server the device fails to register with the below error logs. This production server has a nginx also in front of it that acts as a reverse proxy to the mobilefirst server and is configured with SSL with a valid CA Issued Certificate. TLSv1.2 with SHA256 Cipher.
2016-08-24 14:57:33.087 MyApp[2388:1849431] [DEBUG] [WL_REQUEST] -[WLRequest sendRequest:path:withOptions:] in WLRequest.m:244 :: Sending request (https://xxx.xxx.xxx.com:443/myapp/authorization/v1/clients/instance) with headers:
{
"Accept-Language" = en;
"User-Agent" = "MyApp/1.0 (iPad; iOS 9.3.2; Scale/2.00)/WLNativeAPI/7.1.0.0";
"X-Requested-With" = XMLHttpRequest;
"x-wl-app-version" = "1.0";
"x-wl-device-id" = "1293712973921739217398217893721";
"x-wl-platform-version" = "7.1.0.0";
}
You can see the request body in the Analytics platform logs.
2016-08-24 14:57:33.094 MyApp[2388:1849431] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper start] in WLAFHTTPRequestOperationManagerWrapper.m:356 :: Starting the request with URL https://xxx.xxx.xxx.xxx.com:443/myapp/authorization/v1/clients/instance
2016-08-24 14:57:33.095 MyApp[2388:1849431] [DEBUG] [WL_REQUEST] __42-[WLRequest sendRequest:path:withOptions:]_block_invoke in WLRequest.m:254 :: waiting for response... (Thread=<NSThread: 0x13cd16140>{number = 1, name = main})
2016-08-24 14:57:33.096 MyApp[2388:1849431] THREAD WARNING: ['WLAuthorizationManagerPlugin'] took '86.991943' ms. Plugin should use a background thread.
08-24 14:57:33.455 INFO App Sending no login credential event with cause 0 [ UserCredentialReportThread_0, SendNoLoginCredentialEvent, /Users/iosbuild/TAGS/TAG_VC_3_3_4_0004/Products/Client/ClientLib/AppLogic.cpp:15304 ]
2016-08-24 14:57:33.455 MyApp[2388:1849664] Received event=202002
2016-08-24 14:57:33.456 MyApp[2388:1849664] Sending Data to JS key callStatus, value 202002
2016-08-24 14:57:33.456 MyApp[2388:1849664] Unknown event 202002
2016-08-24 14:57:34.409 MyApp[2388:1849431] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:388 :: Request Failed
2016-08-24 14:57:34.412 MyApp[2388:1849431] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:389 :: Response Status Code : 404
2016-08-24 14:57:34.415 MyApp[2388:1849431] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:390 :: Response Error : Request failed: not found (404)
2016-08-24 14:57:34.420 MyApp[2388:1849431] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/05/13 10:26:34
2016-08-24 14:57:34.421 MyApp[2388:1849431] [ERROR] [WL_REQUEST] -[WLRequest requestFailed:error:] in WLRequest.m:509 :: Status code='404' error='Request
I thought the issue was caused by the Reverse proxy so i decided to install the desktopbrowser version in the production but i dont have any 404 issues with the desktopbrowser. The certificate is also trusted by the browser.
Looking forward for your help guys. Thanks in advance.

ios push notification not working with urban airship

I am trying to add push notification in my iOS PhoneGap app. I am using Command Line Interface (CLI) to create PhoneGap app and add urban airship plugin. I am taking help from this link https://github.com/urbanairship/phonegap-ua-push. I changed config.xml from this location project folder/platforms/ios/Project_name/config.xml
below is my log
2014-03-31 14:03:12.435 ListCreator[3129:60b] Multi-tasking -> Device: YES, App: YES
2014-03-31 14:03:12.481 ListCreator[3129:60b] Unlimited access to network resources
2014-03-31 14:03:12.605 ListCreator[3129:60b] [W] -[UAConfig validate] [Line 157] Production App Key is not valid.
2014-03-31 14:03:12.607 ListCreator[3129:60b] [W] -[UAConfig validate] [Line 161] Production App Secret is not valid.
2014-03-31 14:03:12.609 ListCreator[3129:60b] [I] +[UAirship executeUnsafeTakeOff:] [Line 145] App Key: xxxxxxxxREqtRFvTKQrQIQ
2014-03-31 14:03:12.611 ListCreator[3129:60b] [I] +[UAirship executeUnsafeTakeOff:] [Line 146] App Secret: xxxxxxxqg3C8DCEiWvA
2014-03-31 14:03:12.613 ListCreator[3129:60b] [I] +[UAirship executeUnsafeTakeOff:] [Line 147] Server: https://device-api.urbanairship.com
2014-03-31 14:03:12.617 ListCreator[3129:60b] [D] -[UAirship configureUserAgent] [Line 311] Setting User-Agent for UA requests to ListCreator 1.0 (iPod touch; iPhone OS 7.1; UALib 3.0.3; gDcwCI_1REqtRFvTKQrQIQ; en_US)
2014-03-31 14:03:12.627 ListCreator[3129:60b] [D] void PrintReachabilityFlags(SCNetworkReachabilityFlags, const char *) [Line 79] Reachability Flag Status: -R -----l- networkStatusForFlags
2014-03-31 14:03:12.635 ListCreator[3129:60b] [I] +[UAirship executeUnsafeTakeOff:] [Line 190] Registering UAURLProtocol
2014-03-31 14:03:12.649 ListCreator[3129:60b] [D] -[UALocationService startReportingSignificantLocationChanges] [Line 311] Attempt to start significant change service
2014-03-31 14:03:12.676 ListCreator[3129:60b] [D] -[UALocationService startReportingLocationWithProvider:] [Line 480] Location service not authorized or not enabled
2014-03-31 14:03:12.678 ListCreator[3129:60b] [CDVTimer][pushnotificationplugin] 80.036998ms
2014-03-31 14:03:12.681 ListCreator[3129:60b] [CDVTimer][TotalPluginStartup] 82.762003ms
2014-03-31 14:03:13.416 ListCreator[3129:60b] [D] -[UAStandardLocationProvider locationManager:didChangeAuthorizationStatus:] [Line 54] Standard location authorization changed 0
2014-03-31 14:03:13.417 ListCreator[3129:60b] [D] -[UALocationService locationProvider:withLocationManager:didChangeAuthorizationStatus:] [Line 224] Location service did change authorization status 0
2014-03-31 14:03:13.419 ListCreator[3129:60b] [D] -[UASignificantChangeProvider locationManager:didChangeAuthorizationStatus:] [Line 51] Significant change did change authorization status 0
2014-03-31 14:03:13.421 ListCreator[3129:60b] [D] -[UALocationService locationProvider:withLocationManager:didChangeAuthorizationStatus:] [Line 224] Location service did change authorization status 0
2014-03-31 14:03:14.456 ListCreator[3129:60b] Resetting plugins due to page load.
2014-03-31 14:03:15.043 ListCreator[3129:60b] Finished load of: file:///var/mobile/Applications/1CF70A66-2E2E-41DB-8357-F650DA7B6615/ListCreator.app/www/index.html
2014-03-31 14:03:15.482 ListCreator[3129:60b] THREAD WARNING: ['Notification'] took '158.023926' ms. Plugin should use a background thread.
2014-03-31 14:03:27.645 ListCreator[3129:1403] [D] +[UAKeychainUtils getDeviceID] [Line 238] Retrieved device id info from keychain.
2014-03-31 14:03:27.646 ListCreator[3129:1403] [D] +[UAKeychainUtils getDeviceID] [Line 245] Loaded Device ID: C62AC604-20BA-44C7-BB6D-00E593B491E0
2014-03-31 14:03:27.648 ListCreator[3129:1403] [D] +[UAKeychainUtils getDeviceID] [Line 246] Loaded Model Name: iPod5,1
2014-03-31 14:03:28.513 ListCreator[3129:60b] [D] __39-[UAAnalytics sendOperationWithEvents:]_block_invoke [Line 622] Analytics data sent successfully. Status: 200
In urban airship website i can see that total app open are 5. Here is screen shot http://nevadasoftbd.com/urban-airship.png.
No push can sent and can't login into app also.
Thanks in advance
Looks like you need to verify your Production App Key and your Production App Secret
2014-03-31 14:03:12.605 ListCreator[3129:60b] [W] -[UAConfig validate] [Line 157] Production App Key is not valid.
2014-03-31 14:03:12.607 ListCreator[3129:60b] [W] -[UAConfig validate] [Line 161] Production App Secret is not valid.
Also you need to verify you are looking at the correct 'App' in Urban Airship, either the Production app or the Developer app.

Urbanairship not working on boot

I'm trying to integrate UrbanAirship into my app and have run consistently into the following errors:
2013-10-08 11:07:29.381 iostestapp[1949:60b] [I] +[UAirship executeUnsafeTakeOff:] [Line 143] App Key: <key>
2013-10-08 11:07:29.383 iostestapp[1949:60b] [I] +[UAirship executeUnsafeTakeOff:] [Line 144] App Secret: <secret>
2013-10-08 11:07:29.385 iostestapp[1949:60b] [I] +[UAirship executeUnsafeTakeOff:] [Line 145] Server: https://device-api.urbanairship.com
2013-10-08 11:07:29.388 iostestapp[1949:60b] [D] -[UAirship configureUserAgent] [Line 297] Setting User-Agent for UA requests to iostestapp 1.0 (iPhone; iPhone OS 7.0.2; UALib 3.0.0; <key>; en_US)
2013-10-08 11:07:29.404 iostestapp[1949:60b] [D] void PrintReachabilityFlags(SCNetworkReachabilityFlags, const char *) [Line 79] Reachability Flag Status: -R -----l- networkStatusForFlags
2013-10-08 11:07:29.453 iostestapp[1949:60b] [E] -[UAAutoAppDelegate application:didFailToRegisterForRemoteNotificationsWithError:] [Line 43] Failed To Register For Remote Notifications With Error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x16eab540 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}
2013-10-08 11:07:44.418 iostestapp[1949:430b] [D] +[UAKeychainUtils getDeviceID] [Line 227] Retrieved device id info from keychain.
2013-10-08 11:07:44.419 iostestapp[1949:430b] [D] +[UAKeychainUtils getDeviceID] [Line 234] Loaded Device ID: 707C3963-D503-450F-B8DA-7499E18CB14D
2013-10-08 11:07:44.421 iostestapp[1949:430b] [D] +[UAKeychainUtils getDeviceID] [Line 235] Loaded Model Name: iPhone5,1
2013-10-08 11:07:44.824 iostestapp[1949:60b] [D] __39-[UAAnalytics sendOperationWithEvents:]_block_invoke [Line 622] Analytics data sent successfully. Status: 200
Here's the code that I wrote for it:
UAConfig *config = [UAConfig defaultConfig];
[UAirship takeOff:config];
[UAPush shared].notificationTypes = (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeNewsstandContentAvailability);
[[UAPush shared] setPushEnabled:YES];
.plist already has the proper keys and I've already registered my bundle ID with apple. Anything else that I'm missing? I went through the docs like 5 times.
Is your App prompting you to enable push notifications when the app starts up? If not it may be a provisioning profile and push certificate issue:
http://docs.urbanairship.com/build/ios.html#production-vs-development-apps-in-urban-airship
Also, be sure to align development credentials with development & vica versa with production.

Resources