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.
Related
Hi I recently had develop small sample application using IBM MobileFirst 7.1. I have successfully run app on simulator, it able to login perfectly without error but when I tested on actual device (iOS 9.2) the app failed to login here is some error log I receive
2016-02-16 15:31:39.847 YITCallCenter[3010:1041692] [DEBUG] [WL_REQUEST] -[WLRequest sendRequest:path:withOptions:] in WLRequest.m:221 :: Sending request (http://10.12.11.59:10080/YITCallCenter/authorization/v1/clients/instance) with headers:
{
"Accept-Language" = "th-TH";
"User-Agent" = "YITCallCenter/1.0 (iPhone; iOS 9.2.1; Scale/3.00)/WLNativeAPI/7.1.0.0";
"X-Requested-With" = XMLHttpRequest;
"x-wl-app-version" = "1.0";
"x-wl-device-id" = "AACA3EB7-EEF1-429A-A9A7-597231D2C8B2";
"x-wl-platform-version" = "7.1.0.0";
}
You can see the request body in the Analytics platform logs.
2016-02-16 15:31:39.855 YITCallCenter[3010:1041692] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper start] in WLAFHTTPRequestOperationManagerWrapper.m:332 :: Starting the request with URL http://10.12.11.59:10080/YITCallCenter/authorization/v1/clients/instance
2016-02-16 15:31:39.857 YITCallCenter[3010:1041692] [DEBUG] [WL_REQUEST] __42-[WLRequest sendRequest:path:withOptions:]_block_invoke in WLRequest.m:231 :: waiting for response... (Thread=<NSThread: 0x155d04d90>{number = 1, name = main})
2016-02-16 15:31:39.860 YITCallCenter[3010:1041692] THREAD WARNING: ['WLAuthorizationManagerPlugin'] took '98.279053' ms. Plugin should use a background thread.
2016-02-16 15:31:39.933 YITCallCenter[3010:1041692] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFinished:] in WLAFHTTPRequestOperationManagerWrapper.m:345 :: Request Success
2016-02-16 15:31:39.935 YITCallCenter[3010:1041692] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFinished:] in WLAFHTTPRequestOperationManagerWrapper.m:346 :: Response Status Code : 200
2016-02-16 15:31:39.938 YITCallCenter[3010:1041692] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/01/25 08:04:23
2016-02-16 15:31:39.942 YITCallCenter[3010:1041692] [DEBUG] [WL_REQUEST] -[WLRequest requestFinished:] in WLRequest.m:365 :: Response Header: {
"Content-Length" = 887;
"Content-Type" = "application/json;charset=UTF-8";
Date = "Tue, 16 Feb 2016 08:32:14 GMT";
"X-Powered-By" = "Servlet/3.0";
}
Response Data: {"certificate":"MIICfzCCAWegAwIBAgIJAPVYUEY0ukWzMA0GCSqGSIb3DQEBCwUAMGsxCzAJBgNVBAYTAklMMQswCQYDVQQIEwJJTDERMA8GA1UEBxMIU2hlZmF5aW0xDDAKBgNVBAoTA0lCTTEcMBoGA1UECxMTTW9iaWxlRmlyc3RQbGF0Zm9ybTEQMA4GA1UEAxMHTUZQIERldjAgFw0xNjAyMTYwODMyMTVaGA8yMDY2MDIxNjA4MzIxNVowWTEdMBsGCgmSJomT8ixkARkWDVlJVENhbGxDZW50ZXIxODA2BgoJkiaJk\/IsZAEBEyg2ODhiYzhkOGViYWNkNGY0M2FkYjBjMjE0NzQ0NjNiNTUwZDcwYWUwMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAM0NKuJEcSlRDEFxM6+rapjpLaNw89GH+IYF6uJy11dxJsyrwzveaD\/cLyhNrwp4riu+RpkJeFj\/JMwR1\/9dZNMCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAYaTY7AYVB\/jpRxsEHADCbzeUcSjr65qN\/0c6EgIJ3GTSXQOtpRl7ApdBot6GMeMSZbXQRFZc9OWtZ8V3ww7UOCwrWPY9RlykNqaH5ViPnTHTjBdrd0HrIb+HrK67E+FKWQhdeE5xL+YSGiQTB7IOunYCJbII91y+s\/MDwIQNppcG2FNKLoEoiDPBPnesjNXYa+sNaexXK4NhqosP8KNoac6IcOPoaLaAosnRWKd+y13vWxLCpu86UKbkA668SpUXky9I94X1NXJIFKlHKwzX4AuHji5JbkcnVLjm77rvmIujHLxrNn1LX9jTq\/ofFfiOF4ae752\/G6olUS5ln5O4SA=="}
Status code=200
2016-02-16 15:31:39.944 YITCallCenter[3010:1041692] [DEBUG] [WL_REQUEST] -[WLRequest requestFinished:] in WLRequest.m:424 :: NSS object is null
2016-02-16 15:31:39.948 YITCallCenter[3010:1041692] [DEBUG] [CERTIFICATE_MANAGER] BOOL hasCertificateExpired(X509 *) in WLCertManager.m:647 :: Certificate currentDate: 2016-02-16 08:31:39 +0000, expiryDate: 1523-02-16 08:32:15 +0000
2016-02-16 15:31:39.951 YITCallCenter[3010:1041692] [WARN] [CERTIFICATE_MANAGER] BOOL hasCertificateExpired(X509 *) in WLCertManager.m:649 :: Certificate has expired. Certificate expired on: 1523-02-16 08:32:15 +0000, verified on: 2016-02-16 08:31:39 +0000
2016-02-16 15:31:39.954 YITCallCenter[3010:1041692] [DEBUG] [WL_AUTH] -[WLAuthorizationManager failRegistratioWithResponse:] in WLAuthorizationManager.m:866 :: Response does not contain a valid certificate and client Id. device registration failed
2016-02-16 15:31:39.967 YITCallCenter[3010:1041692] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager removeKey:] in WLCertManager.m:262 :: Key was successfully removed.
2016-02-16 15:31:39.978 YITCallCenter[3010:1041692] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager removeKey:] in WLCertManager.m:262 :: Key was successfully removed.
2016-02-16 15:31:39.986 YITCallCenter[3010:1041692] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/01/25 08:04:23
2016-02-16 15:31:40.001 YITCallCenter[3010:1041692] [DEBUG] [WORKLIGHT] -[NotificationEx loadingStop:] in NotificationEx.m:150 :: Loading stop
2016-02-16 15:31:40.002 YITCallCenter[3010:1042149] [DEBUG] [NONE] Client registration failed with error: {"responseHeaders":{},"status":200,"responseText":"Invalid response when registering application","invocationContext":null}
2016-02-16 15:31:40.005 YITCallCenter[3010:1042108] [ERROR] [NONE] [/apps/services/api/YITCallCenter/iphone/query] failure. state: 200, response: undefined
2016-02-16 15:31:40.088 YITCallCenter[3010:1041692] THREAD WARNING: ['Notification'] took '84.625732' ms. Plugin should use a background thread.
I think the most interesting error is
[WL_AUTH] -[WLAuthorizationManager failRegistratioWithResponse:] in WLAuthorizationManager.m:866 :: Response does not contain a valid certificate and client Id. device registration failed
PS I have already set ipaddress instead of localhost
I was having this exact problem with all of my upgraded 7.1 iOS mobilefirst applications. I discovered that the App Authenticity was turned on to Basic for iOS by default now (new in MobileFirst 7.1) because I had an existing section in my application-descriptor.xml. Removing the security section from my application-descriptor.xml and rebuilding and redeploying the wlapp files fixed my problem. I followed this approach.
How to disable app authenticity on IBM MobileFirst 7.1 remote server?
I suggest to try the following, as mentioned in this answer: Unable to login to app on device or simulator after upgrade to iOS 9 and MobileFirst 7.1
Update the host value in worklight.plist to match the one of the server you attempt to connect to. Then see if it fails still.
I find out there bug on Mobile First itself it turn out that when I set my iPhone calendar buddhist to Gregorian the application able to login. Recommended IBM to come out with patch Thank you
Hi I recently had develop small sample application using IBM MobileFirst 7.1. I have successfully run app on simulator, it able to login perfectly without error but when I tested on actual device (iOS 9.2) the app failed to login here is some error log I receive
2016-02-16 15:31:39.847 YITCallCenter[3010:1041692] [DEBUG] [WL_REQUEST] -[WLRequest sendRequest:path:withOptions:] in WLRequest.m:221 :: Sending request (http://10.12.11.59:10080/YITCallCenter/authorization/v1/clients/instance) with headers:
{
"Accept-Language" = "th-TH";
"User-Agent" = "YITCallCenter/1.0 (iPhone; iOS 9.2.1; Scale/3.00)/WLNativeAPI/7.1.0.0";
"X-Requested-With" = XMLHttpRequest;
"x-wl-app-version" = "1.0";
"x-wl-device-id" = "AACA3EB7-EEF1-429A-A9A7-597231D2C8B2";
"x-wl-platform-version" = "7.1.0.0";
}
You can see the request body in the Analytics platform logs.
2016-02-16 15:31:39.855 YITCallCenter[3010:1041692] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper start] in WLAFHTTPRequestOperationManagerWrapper.m:332 :: Starting the request with URL http://10.12.11.59:10080/YITCallCenter/authorization/v1/clients/instance
2016-02-16 15:31:39.857 YITCallCenter[3010:1041692] [DEBUG] [WL_REQUEST] __42-[WLRequest sendRequest:path:withOptions:]_block_invoke in WLRequest.m:231 :: waiting for response... (Thread=<NSThread: 0x155d04d90>{number = 1, name = main})
2016-02-16 15:31:39.860 YITCallCenter[3010:1041692] THREAD WARNING: ['WLAuthorizationManagerPlugin'] took '98.279053' ms. Plugin should use a background thread.
2016-02-16 15:31:39.933 YITCallCenter[3010:1041692] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFinished:] in WLAFHTTPRequestOperationManagerWrapper.m:345 :: Request Success
2016-02-16 15:31:39.935 YITCallCenter[3010:1041692] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFinished:] in WLAFHTTPRequestOperationManagerWrapper.m:346 :: Response Status Code : 200
2016-02-16 15:31:39.938 YITCallCenter[3010:1041692] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/01/25 08:04:23
2016-02-16 15:31:39.942 YITCallCenter[3010:1041692] [DEBUG] [WL_REQUEST] -[WLRequest requestFinished:] in WLRequest.m:365 :: Response Header: {
"Content-Length" = 887;
"Content-Type" = "application/json;charset=UTF-8";
Date = "Tue, 16 Feb 2016 08:32:14 GMT";
"X-Powered-By" = "Servlet/3.0";
}
Response Data: {"certificate":"MIICfzCCAWegAwIBAgIJAPVYUEY0ukWzMA0GCSqGSIb3DQEBCwUAMGsxCzAJBgNVBAYTAklMMQswCQYDVQQIEwJJTDERMA8GA1UEBxMIU2hlZmF5aW0xDDAKBgNVBAoTA0lCTTEcMBoGA1UECxMTTW9iaWxlRmlyc3RQbGF0Zm9ybTEQMA4GA1UEAxMHTUZQIERldjAgFw0xNjAyMTYwODMyMTVaGA8yMDY2MDIxNjA4MzIxNVowWTEdMBsGCgmSJomT8ixkARkWDVlJVENhbGxDZW50ZXIxODA2BgoJkiaJk\/IsZAEBEyg2ODhiYzhkOGViYWNkNGY0M2FkYjBjMjE0NzQ0NjNiNTUwZDcwYWUwMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAM0NKuJEcSlRDEFxM6+rapjpLaNw89GH+IYF6uJy11dxJsyrwzveaD\/cLyhNrwp4riu+RpkJeFj\/JMwR1\/9dZNMCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAYaTY7AYVB\/jpRxsEHADCbzeUcSjr65qN\/0c6EgIJ3GTSXQOtpRl7ApdBot6GMeMSZbXQRFZc9OWtZ8V3ww7UOCwrWPY9RlykNqaH5ViPnTHTjBdrd0HrIb+HrK67E+FKWQhdeE5xL+YSGiQTB7IOunYCJbII91y+s\/MDwIQNppcG2FNKLoEoiDPBPnesjNXYa+sNaexXK4NhqosP8KNoac6IcOPoaLaAosnRWKd+y13vWxLCpu86UKbkA668SpUXky9I94X1NXJIFKlHKwzX4AuHji5JbkcnVLjm77rvmIujHLxrNn1LX9jTq\/ofFfiOF4ae752\/G6olUS5ln5O4SA=="}
Status code=200
2016-02-16 15:31:39.944 YITCallCenter[3010:1041692] [DEBUG] [WL_REQUEST] -[WLRequest requestFinished:] in WLRequest.m:424 :: NSS object is null
2016-02-16 15:31:39.948 YITCallCenter[3010:1041692] [DEBUG] [CERTIFICATE_MANAGER] BOOL hasCertificateExpired(X509 *) in WLCertManager.m:647 :: Certificate currentDate: 2016-02-16 08:31:39 +0000, expiryDate: 1523-02-16 08:32:15 +0000
2016-02-16 15:31:39.951 YITCallCenter[3010:1041692] [WARN] [CERTIFICATE_MANAGER] BOOL hasCertificateExpired(X509 *) in WLCertManager.m:649 :: Certificate has expired. Certificate expired on: 1523-02-16 08:32:15 +0000, verified on: 2016-02-16 08:31:39 +0000
2016-02-16 15:31:39.954 YITCallCenter[3010:1041692] [DEBUG] [WL_AUTH] -[WLAuthorizationManager failRegistratioWithResponse:] in WLAuthorizationManager.m:866 :: Response does not contain a valid certificate and client Id. device registration failed
2016-02-16 15:31:39.967 YITCallCenter[3010:1041692] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager removeKey:] in WLCertManager.m:262 :: Key was successfully removed.
2016-02-16 15:31:39.978 YITCallCenter[3010:1041692] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager removeKey:] in WLCertManager.m:262 :: Key was successfully removed.
2016-02-16 15:31:39.986 YITCallCenter[3010:1041692] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/01/25 08:04:23
2016-02-16 15:31:40.001 YITCallCenter[3010:1041692] [DEBUG] [WORKLIGHT] -[NotificationEx loadingStop:] in NotificationEx.m:150 :: Loading stop
2016-02-16 15:31:40.002 YITCallCenter[3010:1042149] [DEBUG] [NONE] Client registration failed with error: {"responseHeaders":{},"status":200,"responseText":"Invalid response when registering application","invocationContext":null}
2016-02-16 15:31:40.005 YITCallCenter[3010:1042108] [ERROR] [NONE] [/apps/services/api/YITCallCenter/iphone/query] failure. state: 200, response: undefined
2016-02-16 15:31:40.088 YITCallCenter[3010:1041692] THREAD WARNING: ['Notification'] took '84.625732' ms. Plugin should use a background thread.
I think the most interesting error is
[WL_AUTH] -[WLAuthorizationManager failRegistratioWithResponse:] in WLAuthorizationManager.m:866 :: Response does not contain a valid certificate and client Id. device registration failed
PS I have already set ipaddress instead of localhost
I was having this exact problem with all of my upgraded 7.1 iOS mobilefirst applications. I discovered that the App Authenticity was turned on to Basic for iOS by default now (new in MobileFirst 7.1) because I had an existing section in my application-descriptor.xml. Removing the security section from my application-descriptor.xml and rebuilding and redeploying the wlapp files fixed my problem. I followed this approach.
How to disable app authenticity on IBM MobileFirst 7.1 remote server?
I suggest to try the following, as mentioned in this answer: Unable to login to app on device or simulator after upgrade to iOS 9 and MobileFirst 7.1
Update the host value in worklight.plist to match the one of the server you attempt to connect to. Then see if it fails still.
I find out there bug on Mobile First itself it turn out that when I set my iPhone calendar buddhist to Gregorian the application able to login. Recommended IBM to come out with patch Thank you
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);
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.
I am creating a PhoneGap application for iOS and Android. I have gotten Android to work perfectly fine, but am having trouble switching from Development to Production in iOS. A device token is not being registered for the device with a production adHoc build. I have exhausted every thing I could think of. Here is what I have done so far:
Deleted all certificates and provisiong profiles on my computer to try and start over fresh.
Enabled production APNS on my application specific app id (not wildcard app id) and imported it into my keychain.
Created new production provisioning profile for adHoc distribution using the production ssl certificate and correct app id. Checked to make sure aps-environment was set in the provision profile.
Imported the new provisioning profile and set the application to use the correct one in my build settings for project and targets.
Exported the p12 file for importing into UA.
Deleted and created a new application on UA set for production use. Uploaded the p12 file and turned on Push Debug mode.
Made sure the AirshipConfig.plist had the correct production keys and was set APP_STORE_OR_AD_HOC_BUILD to YES.
Archived the app and exported it for adhoc distribution and loaded it onto the phone via itunes.
When I run the app for the first time on the device with everything completely redone. This is what I get in the console:
Mon Sep 17 12:48:00 unknown XXXXXXXXX[5039] Warning: Multi-tasking - Device: NO, App: YES
Mon Sep 17 12:48:05 unknown XXXXXXXXX[5039] Warning: Reachability Flag Status: -R -----l- networkStatusForFlags
Mon Sep 17 12:48:06 unknown XXXXXXXXX[5039] Warning: [M] = -[UAPush updateRegistration] [Line 583] Checking registration state
Mon Sep 17 12:48:06 unknown XXXXXXXXX[5039] Warning: [M] = -[UAUser listenForDeviceTokenReg] [Line 969] ListenForDeviceTokenReg
Mon Sep 17 12:48:06 unknown XXXXXXXXX[5039] Warning: [M] = -[UAUser retrieveRequestSucceeded:] [Line 911] User retrieved: 200:{
"user_id" : "XX-XXXXXXXXXXXXXXXXX",
"user_url" : "https://device-api.urbanairship.com/api/user/XX-XXXXXXXXXXXXXXXXX/",
"tags" : [ ],
"device_tokens" : [ ],
"device_pins" : [ ],
"apids" : [ ],
"has_active_subscription" : false,
"subscriptions" : [ ],
"ua_device_ids" : [ "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ],
"badge" : 0,
"server_time" : "2012-09-17 17:48:02"
}
Mon Sep 17 12:48:06 unknown XXXXXXXXX[5039] Warning: [M] = -[UAUser updateDefaultDeviceToken] [Line 1016] Updating device token
Mon Sep 17 12:48:06 unknown XXXXXXXXX[5039] Warning: [M] = -[UAUser updateDefaultDeviceToken] [Line 1021] Skipping device token update: no token, already up to date, or user is being updated.
Mon Sep 17 12:48:21 unknown XXXXXXXXX[5039] Warning: [M] = +[UAKeychainUtils getDeviceID] [Line 269] Retrieved device id info from keychain.
Mon Sep 17 12:48:21 unknown XXXXXXXXX[5039] Warning: [M] = +[UAKeychainUtils getDeviceID] [Line 273] Device ID result is not nil.
Mon Sep 17 12:48:21 unknown XXXXXXXXX[5039] Warning: [M] = +[UAKeychainUtils getDeviceID] [Line 282] Loaded Device ID: XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Mon Sep 17 12:48:21 unknown XXXXXXXXX[5039] Warning: [M] = +[UAKeychainUtils getDeviceID] [Line 283] Loaded Model Name: iPhone1,2
Mon Sep 17 12:48:21 unknown XXXXXXXXX[5039] Warning: [M] = -[UAAnalytics requestDidSucceed:response:responseData:] [Line 467] Analytics data sent successfully. Status: 200
I blanked out the ID numbers and app name.
This message above "Skipping device token update: no token, already up to date, or user is being updated." seems weird to me. This is a newly created UA Application with new keys and everything. I also loaded it up with my development profile, keys and everything and it works just fine. It just does not register device tokens in a production run.
Any help is appreciated. I have checked every setting and as far as I can tell all of my profiles, keys, entitlements are all set properly. I am running on WiFi since the phone I am using is just a test phone that doesn't have active carrier service.
I've now solved this problem twice, I think, though I'm not 100% sure what the core problem is - i think there's an issue with how you test it.
Try to get the UA Push Sample app to work:
Download the UA PushSample app.
update the AirshipConfig.plist file with your app/secret combo
update the build with the right bundle ID, provisioning profile, etc.
delete your app from your device (they'll clash when you try to build the PushSample app if it's still on there with the same bundle identifier.
compile and run the push sample app.
look for a token in the log, and also check the UA dashboard (for # tokens, or just send a broadcast alert).
Do you still have the same issue? In my case, both times, it went away and was successfully able to register the token. I think that for some reason the mis-configured certs / provisioning profiles prevented the token from being created properly. When I fixed them - it was too late, because the UA library thought it had registered and was therefore skipping over that part. This line in the log is what made me suspect:
Checking registration on app foreground disabled on app initialization
Now 2 for 2, when I put the correct certs/bundle/provisioning profile in the clean PushSample app, it worked properly