Device Token registering fine in development, but not production - ios

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

Related

react-native app fail to start after a few days

I'm gonna try to explain the problem as clearly as possible, here are the steps:
I compile the app on the device (width bundled file on disk - Options 2)
The app starts, and work
After a few days, when i click on the app's icon, it open the 'powered by react-native' screen, then it crash
I had the same problem over multiple devices, and multiple times
I'm pretty sure it is not a JS error, since nothings change between the day it work, and the day it doesnt
here's the app logs on app start:
$ cat crachReport|grep MyApp
Aug 29 14:26:47 Abels-iPhone amfid[1524] <Notice>: /private/var/containers/Bundle/Application/BDC567B0-B341-4B9A-8329-90B5CEC26440/MyApp.app/MyApp not valid: 0xe8008015: A valid provisioning profile for this executable was not found.
Aug 29 14:26:47 Abels-iPhone SpringBoard(BaseBoard)[1682] <Error>: Unable to get pid for 'UIKitApplication:org.reactjs.native.example.MyApp[0x9347]': No such process (err 3)
Aug 29 14:26:47 Abels-iPhone SpringBoard(FrontBoard)[1682] <Error>: Bootstrapping failed for <FBApplicationProcess: 0x1705f9500; org.reactjs.native.example.MyApp; pid: -1>
Aug 29 14:26:47 Abels-iPhone sharingd[62] <Notice>: SystemUI unknown identifier: 'org.reactjs.native.example.MyApp'
the unfound provisionning profile error does not appear on the logs when the app work, so i think it may come from here.
However i'm not sure since i'm new to ios developpement,
Thanks in advance
After compilation with a valid provisionning profile, this problem does not appear.
The default provisionning profile was valid for 7 days, so the error was coming from there.

App installation failed: Unknown Error Xcode 7

My app runs fine in the simulator, but when I try to install it on my iPhone it says
App installation failed: An unknown error has occurred.
I opened my device logs and got this:
Nov 12 21:17:19 Isaacs-iPhone streaming_zip_conduit[5853] : LaunchServices: installing app for existing placeholder Raritea.FSS-App <(null) Not found in database>
Nov 12 21:17:19 Isaacs-iPhone streaming_zip_conduit[5853] : LaunchServices: Not creating progress for Raritea.FSS-App <(null) Not found in database> since it is not a placeholder.
Nov 12 21:17:19 Isaacs-iPhone installd[4549] : 0x16e1bb000 -[MIClientConnection installPath:withOptions:completion:]: Install of "/var/mobile/Media/PublicStaging/FSS App.app" type Developer (LSInstallType = (null)) requested by streaming_zip_conduit (pid 5853)
Nov 12 21:17:19 Isaacs-iPhone installd[4549] : 0x16e12f000 -[MIInstaller performInstallationWithError:]: Installing
Nov 12 21:17:20 Isaacs-iPhone profiled[4644] : (Note ) MC: Provisioning profiles changed
Nov 12 21:17:20 Isaacs-iPhone profiled[4644] : (Note ) MC: Updating MIS trust...
Nov 12 21:17:20 Isaacs-iPhone securityd[4588] : secTaskDiagnoseEntitlements MISSING keychain entitlements: no stored taskRef found
Nov 12 21:17:20 Isaacs-iPhone securityd[4588] : secTaskDiagnoseEntitlements MISSING keychain entitlements: no stored taskRef found
Nov 12 21:17:20 Isaacs-iPhone installd[4549] : SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Nov 12 21:17:20 Isaacs-iPhone profiled[4644] : (Note ) MC: Provisioning profiles changed
Nov 12 21:17:20 Isaacs-iPhone profiled[4644] : (Note ) MC: Updating MIS trust...
Nov 12 21:17:20 Isaacs-iPhone installd[4549] : unrecognized status -67049 from codesigning library
Nov 12 21:17:20 Isaacs-iPhone installd[4549] : 0x16e12f000 +[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL:withOptions:error:]: 142: Failed to verify code signature of /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.FvOJz0/extracted/FSS App.app/PlugIns/QuickSched.appex : 0xe8008001 (An unknown error has occurred.)
Nov 12 21:17:20 Isaacs-iPhone installd[4549] : 0x16e12f000 -[MIInstaller performInstallationWithError:]: Verification stage failed
Nov 12 21:17:20 Isaacs-iPhone streaming_zip_conduit[5853] : 0x16e087000 __MobileInstallationInstallForLaunchServices_block_invoke222: Returned error Error Domain=MIInstallerErrorDomain Code=13 "Failed to verify code signature of /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.FvOJz0/extracted/FSS App.app/PlugIns/QuickSched.appex : 0xe8008001 (An unknown error has occurred.)" UserInfo={LibMISErrorNumber=-402620415, LegacyErrorString=ApplicationVerificationFailed, SourceFileLine=142, FunctionName=+[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL:withOptions:error:], NSLocalizedDescription=Failed to verify code signature of /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.FvOJz0/extracted/FSS App.app/PlugIns/QuickSched.appex : 0xe8008001 (An unknown error has occurred.)}
Nov 12 21:17:20 Isaacs-iPhone streaming_zip_conduit[5853] : ERROR: MobileInstallationInstallForLaunchServices returned nil
Nov 12 21:17:20 Isaacs-iPhone streaming_zip_conduit[5853] : __dispatch_source_read_socket_block_invoke:274: Failed to install application at file:///var/mobile/Media/PublicStaging/FSS%20App.app/ : Error Domain=LaunchServicesError Code=0 "(null)" UserInfo={Error=ApplicationVerificationFailed, ErrorDetail=-402620415, ErrorDescription=Failed to verify code signature of /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.FvOJz0/extracted/FSS App.app/PlugIns/QuickSched.appex : 0xe8008001 (An unknown error has occurred.)}
This line in the device logs stood out to me, and hopefully you saw it too:
Failed to verify code signature of /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.FvOJz0/extracted/FSS App.app/PlugIns/QuickSched.appex
This is saying that (although Xcode thought everything was OK at build time), your device rejected the code signature of your app extension.
There are a few solutions here, but in my personal experience, this issue can only be fixed by tinkering with the code signing settings for your app and app extension. Make sure that the app and app extension are being signed with the same certificate (although likely different provisioning profiles).
As others have recommended, I've also been able to fix this by running the Clean action in Xcode for the project, and also by deleting the derived data directories. But I have not always been successful with this.
This happened to me before. I had to navigate to derived data and delete it. Restart Xcode. Solved the issue for me. You may want to restart your computer as well.
I have had luck by disconnecting my iPhone from my mac, and then Analyzing (Shift + Command + B or Product -> Analyze).
After that I plugged my iPhone back in and did a clean (Command + k) and then ran! Worked!
I spent a long time on this issue. Doing the following in XCode finally resolved it for me. Some of this is mentioned already, but no.4 finally resolved it for me.
Product > Clean Build Folder (Cmd+Shift+K)
Project > Target (Project) > Build Settings, and check if path of "Info.plist" file is same as the path you get if you right click on the file > Show file inspector > location="Relative to Project"
Disconnect Phone & restart laptop & restart phone
Project > Target (Project) > Build Settings, and ensure "Excluded Architectures" is empty. Mine had arm64 in excluded architectures for some reason.
Hopefully this helps.
I had the same problem but with an app without app extension on XCode 10.2.1.
None of the solutions worked for me, so I deleted the XCode target and recreated it with the same files and settings. This worked for me.
try it :
Xcode-> Preferences->Locations->Derived Data-> Delete it...
It will clean your project,
Try to restart your device.
Then build the app on the device.
I also had this problem, in device log it said that code signing failed for my app extension ....appex. I went to my App Target -> Build phases -> Embed App Extensions and checked Copy only when installing, after that I could install the app on the phone.
This worked for me :
1) Product > Archive (From Xcode)
2) Export iPa
3) Install this iPa from iTunes or Diawi.

iAP work in Sandbox but not in 'Pending Developer Release' version

Our app has passed review, and is pending developer release. I've downloaded a copy using a promo code, but none of our in App purchases work (they work fine using a sandbox account created in iTunes Connect however). iAP are approved and cleared for sale in iTunes Connect.
They are reporting this error in the console on attempted purchase:
Nov 22 20:58:34 iOS-8-tester-takp accountsd[3148] <Warning>: AIDA Notification plugin running
Nov 22 20:58:36 iOS-8-tester-takp backupd[3317] <Warning>: INFO: Account changed (enabled=1, accountID=REDACTED)
Nov 22 20:58:49 iOS-8-tester-takp backupd[3318] <Warning>: INFO: Account changed (enabled=1, accountID=REDACTED)
Nov 22 20:58:49 iOS-8-tester-takp itunesstored[78] <Warning>: Could not load library [21]
Nov 22 20:58:51 iOS-8-tester-takp accountsd[3148] <Warning>: [Warning] Unhandled server key: alert
Nov 22 20:58:52 iOS-8-tester-takp identityservicesd[42] <Warning>: [Warning] IDS access warning: Allowing wildcard access for service: com.apple.private.alloy.bulletinboard entitlement: com.apple.private.ids.registration client: com.apple.Accounts:accountsd:3148 entitlements: {
"com.apple.private.ids.messaging" = (
"com.apple.private.alloy.accountssync"
);
"com.apple.private.ids.messaging.high-priority" = (
"com.apple.private.alloy.accountssync"
);
"com.apple.private.ids.registration" = 1;
}
Perhaps this is a server error - but it's making me really nervous with our release coming up. Can anyone help?
This appears to have been a server error. It fixed itself 3 or 4 days after moving to 'Pending Developer Release' and operates as expected now, with no change in the application's code.

Ad-hoc distribution fail

I work for a big company, and I'm developing an iOS app for iOS 5+. The only way the app will be distributed will be through ad-hoc deployment.
I have had my own server for some time, hosted by o2switch (french hoster). As I started the development, we used it to deploy the app for beta testing purposes. It was working pretty well.
As the app entered its final phase, the company bought the same (in fact, they only have a single one) plan at o2switch (as it was working fine on my server). The "new" server works fine, we have the files required by the iOS app on it and we access them correctly.
My problem is that when I deploy over to the company's server, the install keeps crashing ! The bar below the app's icon is empty, the almost full (in no time), and I get an error saying the app could not be installed. (classic)
I have the so-well-known crash log :
unknown itunesstored[1657] <Notice>: MS:Notice: Installing: com.apple.itunesstored [itunesstored] (690.10)
unknown wifid[23] <Error>: WiFi:[375199765.346102]: Client itunesstored is background application
unknown securityd[1659] <Notice>: MS:Notice: Installing: (null) [securityd] (690.10)
unknown SpringBoard[62] <Warning>: could not save thumbnail for downloading icon: image=(null) path='/var/mobile/Library/SpringBoard/DownloadingIconImageCache/***********'
unknown sandboxd[1661] <Notice>: MS:Notice: Installing: (null) [sandboxd] (690.10)
unknown installd[1663] <Notice>: MS:Notice: Installing: (null) [installd] (690.10)
unknown SpringBoard[62] <Warning>: could not save thumbnail for downloading icon: image=(null) path='/var/mobile/Library/SpringBoard/DownloadingIconImageCache/***********'
unknown keybagd[1665] <Notice>: MS:Notice: Installing: (null) [keybagd] (690.10)
unknown securityd[1667] <Notice>: MS:Notice: Installing: (null) [securityd] (690.10)
unknown SpringBoard[62] <Warning>: Killing *********** for app installation
unknown installd[1663] <Error>: 2ffc1000 extract_package: Could not extract archive
unknown installd[1663] <Error>: 2ffc1000 stage_package: Could not extract /var/tmp/install_staging.I0rwBH/foo.zip to /var/tmp/install_staging.I0rwBH/foo_extracted
unknown com.apple.itunesstored[1657] <Notice>: MobileInstallationInstall: failed with -1
unknown installd[1663] <Error>: 2ffc1000 MobileInstallationInstall: Could not stage the package
unknown installd[1663] <Error>: 2ffc1000 handle_install: API failed
unknown installd[1663] <Error>: 2ffc1000 send_message: failed to send mach message of 71 bytes: 10000003
unknown installd[1663] <Error>: 2ffc1000 send_error: Could not send error response to client
I've tried a lot to get rid of this error, but nothing seemed to work. I've read every single answer on SO talking about this issue, and tried everything I could. I re-downloaded the profiles, updated the build number, checked the ipa's url, and so many other things.. Nothing worked.
I had to deliver the app quickly, so I tried one last thing : put it on my server. And it worked perfectly. First try, and with no problem (maybe one, the bar did not load progressively but stayed grey then filled in blue very quick, but that's not a problem, I know it downloaded the online version). Then I re-tried uploading to the new server, same problem.
BTW, I tested with: iPhone4/iOS5, iPhone4S/iOS6, iPhone5/iOS6, iPad3/iOS6 and a couple other devices, over 3G (3 different providers) and Wifi, same problem every single time.
So, my question is the following :
Does / how can the server impact the ad-hoc deployment ?
I can give information on the server's config if required. Please tell me what info you need.
O2switch is investigating, but they don't know much about iOS ad-hoc deployment, so they don't really know where to look, what service the install calls, etc.
So I'm turning (once again) to you, SO's community ! Any ideas ?
Check the mime-type configuration in the web-server. You need:
application/xml for the .plist file, and
application/octet-stream for the .ipa file.
Did you edit the App.plist file before you moved it to the new server?
The assets url must be absolute, like this: <string>http://someurl.com/App-1.0.0.ipa</string>.
If you are absolutely sure that server returns proper mime types, checked by:
lynx -mime_header http://www.serveraddress/App.plist | head -10
If you are sure that you don't have spaces or new lines in link to your .plist file in your html file.
If you are sure that you have added devices to provisioning profile
And if you have read: http://www.informit.com/articles/article.aspx?p=1829415&seqNum=16
I have all files: .plist, .html, .ipa in the same folder
Then I don't know what is the issue and would suggest you to distribute it from your working server.

Not able to install iPhone app with app store distribution profile

Developed my first iPhone app for internal use and it should be distributed internally.
I am able to successfully install it on to the device when I code sign the build with my developer profile. But not able to install the same app(.ipa) using iTunes when code sign the build with App store distribution profile. I am getting the following error.
Oct 1 15:52:32 unknown installd[462] <Error>: profile not valid: 0xe8008012
Oct 1 15:52:32 unknown installd[462] <Error>: 001d7000 install_embedded_profile: Could not install embedded profile: -402620398
Oct 1 15:52:32 unknown installd[462] <Error>: 001d7000 verify_signer_identity: Could not copy validate signature: -402620395
Oct 1 15:52:32 unknown installd[462] <Error>: 001d7000 preflight_application_install: Could not verify executable at /var/tmp/install_staging.1JP9zU/foo_extracted/Payload/mi-ios.app
Oct 1 15:52:32 unknown installd[462] <Error>: 001d7000 install_application: Could not preflight application install
Oct 1 15:52:32 unknown installd[462] <Error>: 001d7000 handle_install: API failed
Oct 1 15:52:32 unknown installd[462] <Error>: 001d7000 send_message: failed to send mach message of 71 bytes: 10000003
Oct 1 15:52:32 unknown installd[462] <Error>: 001d7000 send_error: Could not send error response to client
I made sure the distribution profile is valid(have private key and certificate installed on my mac).
I am not sure what i am missing here. I followed every step given at iOS dev center. Any help would be appreciated.
The App Store profile is, as its name implies, for use only when distributing via the App Store. It exists for signing your app for distribution via the App Store and can't be used for any other purpose. Unless you install an app that has been signed by it via the App Store it will, quite correctly, fail.
If you want to distribute an app for internal use to a few devices and for a relatively short period, you should use an ad hoc profile; if to a lot if users for an extended period, you need to register as a corporate developer and follow a different process.

Resources