Unzip/zip ipa file causes install problems - windows

I have been wrestling with resigning an iOS app (ipa file) provided by a third party. As documented in many other places I am following the process:
unzip
copy embedded.mobileprovision
codesign
zip
Sometimes it works and sometimes it doesn't. The same file will load sometimes and not others. In trying to isolate the problem I have simply unzipped the ipa, then rezipped it. The new ipa file is slightly different to the original but everything inside the original and the new ipa is identical. When I try to install the new ipa file it fails with:
Could not install application on device. Error: A signed resource has been added, modified or deleted.
Looking in the console log of the device I get the following messages:
iPad1 installd[843] : 00403000
verify_signer_identity: Could not copy validate signature: -402620393
iPad1 installd[843] : 00403000
preflight_application_install: Could not verify executable at
/var/tmp/install_staging.VEviVe/BlahBlahBlah.app
iPad1 installd[843] : 00403000
install_application: Could not preflight application install
iPad1 mobile_installation_proxy[876] :
handle_install: Installation failed
Given that nothing inside the ipa file has changed, which is where I thought all the signing information was, why won't the rezipped file install?
Some more info, the error above occurs installing the rezipped ipa file using the iPhone Configuration Utility running under Windows. The rezipped ipa file installs using iTunes but gives the following errors in the console log for the device:
iPad1 installd[918] : entitlement 'aps-environment' has value
not permitted by a provisioning profile
iPad1 installd[918] : entitlement 'application-identifier' has
value not permitted by a provisioning profile

Related

Xcode 10, WatchKit app and distribution error ITMS-90334 with com.apple.wk

I have a project with WatchKit app inside.
It used to work smooth with Xcode 8 and Xcode 9 with automatic signing and distribution. Xcode 10 broke something.
What I have at the moment is this
The main point here is "com.apple.wk"
It has been added somewhere at the re-signing stage by the organizer as far as I can understand.
I checked my project quadriple and I'm 100% sure it doesn't contain "com.apple.wk" string anywhere.
I switched to manual signing. Created new iOS Distribution certificate. Generated 3 Provision profiles with the correct bundles for app, watch app, watchapp extension. The same error is here.
I tried to clean the project, open\close Xcode, reboot the system. No luck.
I'm unable to dilever my IPA to iTunes with the error above.
I tried to export IPA and distribute it with Application Loader. No luck.
The only one place I found "com.apple.wk" string was in packaging log
2018-09-21 06:54:33 +0000 /var/folders/gg/jxvtgf9n07s9m0z_vzqlx0c00000gn/T/XcodeDistPipeline.4mX/Root/Payload/myApp.app/Watch/myApp Watch App.app: replacing existing signature
2018-09-21 06:54:34 +0000 /var/folders/gg/jxvtgf9n07s9m0z_vzqlx0c00000gn/T/XcodeDistPipeline.4mX/Root/Payload/myApp.app/Watch/myApp Watch App.app: signed app bundle with Mach-O universal (armv7k (33554444:1)) [com.apple.WK]
the same time main app and extension have resigned with the correct bundle ids
2018-09-21 06:54:34 +0000 /var/folders/gg/jxvtgf9n07s9m0z_vzqlx0c00000gn/T/XcodeDistPipeline.4mX/Root/Payload/myApp.app: replacing existing signature
2018-09-21 06:54:34 +0000 /var/folders/gg/jxvtgf9n07s9m0z_vzqlx0c00000gn/T/XcodeDistPipeline.4mX/Root/Payload/myApp.app: signed app bundle with Mach-O universal (armv7 arm64) [com.myAppBundleName]
&
2018-09-21 06:54:33 +0000 /var/folders/gg/jxvtgf9n07s9m0z_vzqlx0c00000gn/T/XcodeDistPipeline.4mX/Root/Payload/myApp.app/Watch/myApp Watch App.app/PlugIns/myApp Watch App Extension.appex: signed bundle with Mach-O universal (armv7k (33554444:1)) [com.myAppBundleName.watchkitapp.watchkitextension]
Any ideas how to deliver my app are greatly appreciated.
There are two options:
a.
Open EACH target of your project and change Architectures to $(ARCHS_STANDARD)
clean build folder and try to upload as usual. This should allow you to send it automatically via organizer as usual.
b. If above does not work try next:
Click "Archive" with XCode and get xcarchive file
Open archive in Finder
Start distributing to App Store archive through organizer distribute button
Got the error above
Export created ipa file
Open packaging.log file from the export directory
Search for "com.apple.wk" string to find one
Analyze and play a lot with the codesign request from packaging log here it is
/usr/bin/codesign '-vvv' '--force' '--sign' 'B5152DB7C8BC97C444D44341275F5E1B3336BA3B' '--entitlements' '/var/folders/gg/jxvtgf9n07s9m0z_vzqlx0c00000gn/T/XcodeDistPipeline.vsk/entitlements3uMHR5' '--preserve-metadata=identifier,flags,runtime' '/var/folders/gg/jxvtgf9n07s9m0z_vzqlx0c00000gn/T/XcodeDistPipeline.vsk/Root/Payload/myApp.app/Watch/myApp Watch App.app'
Figure out that if i remove this '--preserve-metadata=identifier,flags,runtime' and rerun this code in bash all is going well and binary is signed with the correct bundle id and not with this com.apple.wk
Copy this signed embedded (the path you are able to find in this request above) watch app binary into the xcarchive file created on the first step with replacing the old one.
Start distributing it back with organizer to App Store
Voila it has been uploaded.
Hope it will help someone.

A sealed resource is missing or invalid

I'm trying to deploy my game made with Unity on Mac Store, but got this error during the validation process. I don't know how to correct. Do you have any ideas please ?
Invalid Signature - The main app bundle Kissoro at path Kissoro.app
has following signing error(s):
--prepared:/Volumes/data01/app_data/dstr/mz_8224354388357841556dir/mz_8662652241696651587dir/com.masseka.game.studio.Kissoro.pkg/Payload/Kissoro.app/Contents/Frameworks/libcrypto.dylib
--validated:/Volumes/data01/app_data/dstr/mz_8224354388357841556dir/mz_8662652241696651587dir/com.masseka.game.studio.Kissoro.pkg/Payload/Kissoro.app/Contents/Frameworks/libcrypto.dylib
--prepared:/Volumes/data01/app_data/dstr/mz_8224354388357841556dir/mz_8662652241696651587dir/com.masseka.game.studio.Kissoro.pkg/Payload/Kissoro.app/Contents/Frameworks/libssl.dylib
--validated:/Volumes/data01/app_data/dstr/mz_8224354388357841556dir/mz_8662652241696651587dir/com.masseka.game.studio.Kissoro.pkg/Payload/Kissoro.app/Contents/Frameworks/libssl.dylib
--prepared:/Volumes/data01/app_data/dstr/mz_8224354388357841556dir/mz_8662652241696651587dir/com.masseka.game.studio.Kissoro.pkg/Payload/Kissoro.app/Contents/Frameworks/Mono/MonoEmbedRuntime/osx/libmono.0.dylib
--validated:/Volumes/data01/app_data/dstr/mz_8224354388357841556dir/mz_8662652241696651587dir/com.masseka.game.studio.Kissoro.pkg/Payload/Kissoro.app/Contents/Frameworks/Mono/MonoEmbedRuntime/osx/libmono.0.dylib
--prepared:/Volumes/data01/app_data/dstr/mz_8224354388357841556dir/mz_8662652241696651587dir/com.masseka.game.studio.Kissoro.pkg/Payload/Kissoro.app/Contents/Frameworks/Mono/MonoEmbedRuntime/osx/libMonoPosixHelper.dylib
--validated:/Volumes/data01/app_data/dstr/mz_8224354388357841556dir/mz_8662652241696651587dir/com.masseka.game.studio.Kissoro.pkg/Payload/Kissoro.app/Contents/Frameworks/Mono/MonoEmbedRuntime/osx/libMonoPosixHelper.dylib
/Volumes/data01/app_data/dstr/mz_8224354388357841556dir/mz_8662652241696651587dir/com.masseka.game.studio.Kissoro.pkg/Payload/Kissoro.app:
a sealed resource is missing or invalid . Refer to the Code Signing
and Application Sandboxing Guide at
http://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/AboutCS/AboutCS.html
and Technical Note 2206 at
https://developer.apple.com/library/mac/technotes/tn2206/_index.html
for more information.
All you have to do is to manually codesign every file in Contents/Frameworks and Contents/Plugins directories inside .app file and to delete all .meta files inside your plugin. After U do these steps, You codesigned once more the whole .app file and create a package which You can uploaded on iTunes Connect without warning mentioned above.
More info: https://forum.unity.com/threads/signing-mac-app-on-os-x-mavericks.206762/

can't share an archive in Xcode due to missing icon\r file

I put my Xcode project within my dropbox folder and now it seems like every time i try to share my archive from within the organizer it keep giving me the following error:
error: Codesign check fails : /var/folders/7l/l93zzs6n4h14qb7rmj5r7zn00000gn/T/GtLyx05w1O/Payload/stryker.app: a sealed resource is missing or invalid
In architecture: armv6
resource added: /private/var/folders/7l/l93zzs6n4h14qb7rmj5r7zn00000gn/T/GtLyx05w1O/Payload/stryker.app/www/Icon
resource missing: /private/var/folders/7l/l93zzs6n4h14qb7rmj5r7zn00000gn/T/GtLyx05w1O/Payload/stryker.app/www/Icon
I believe this error is caused by the fact that Xcode can see the icon/r file associated with drop box.
Is there a way i can delete this file?
I was able to share my archive after I deleted the icon\r file. Please refer to the following post for more info
https://apple.stackexchange.com/questions/31867/what-is-icon-r-file-and-how-do-i-delete-them/31877#31877

Xcode 3.2.5 fail to create IPA file

I'm trying to create an IPA file for my application using XCode 3.2.5 (iOS SDK 4.0). But after doing the "Build and Archive" I try to "Save to disk..." the ipa file and nothing happens. The message "Generating IPA file" just dissapears.
I took a look into the console of the Mac and I think I found the issue but no idea how to fix it. These what I found on the console:
May 13 15:29:58 Jorge-Martin-Garcias-MacBook-Pro Xcode[246]: Running /usr/bin/xcrun with (\n "-sdk",\n iphoneos,\n PackageApplication,\n "-v",\n "/Users/jgarci17/Library/Application Support/Developer/Shared/Archived Applications/16A09235-185F-4F1E-9BFC-A935CAA5699E.apparchive/mWorkf.app",\n "-o",\n "/var/folders/pD/pDPQGhivGCCVBsrZpH0VaU+++TI/-Tmp-/D6E45F6F-264A-4714-955A-1EC44E78DFC0-246-0000AFED061085C5/mWorkf.ipa",\n "--sign",\n "iPhone Distribution: MyCompany LLC",\n "--embed",\n "/Users/jgarci17/Library/MobileDevice/Provisioning Profiles/48D38306-E65F-4D2B-A60A-B94CCD3D518A.mobileprovision"\n)
That seems to be fine, but later ...
May 13 15:29:58 Jorge-Martin-Garcias-MacBook-Pro [0x0-0x16016].com.apple.Xcode[246]: Arguments: embed=/Users/jgarci17/Library/MobileDevice/Provisioning Profiles/48D38306-E65F-4D2B-A60A-B94CCD3D518A.mobileprovision verbose=1
==>output_dir=/var/folders/pD/pDPQGhivGCCVBsrZpH0VaU+++TI/-Tmp-/D6E45F6F-264A-4714-955A-1EC44E78DFC0-246-0000AFED061085C5/mWorkf.ipa <===
sign=iPhone Distribution: MyCompany LLC
May 13 15:29:58 Jorge-Martin-Garcias-MacBook-Pro [0x0-0x16016].com.apple.Xcode[246]: Output directory: '/var/folders/pD/pDPQGhivGCCVBsrZpH0VaU+++TI/-Tmp-/D6E45F6F-264A-4714-955A-1EC44E78DFC0-246-0000AFED061085C5/mWorkf.ipa
As you see the output directory is including the ipa file name ! ... so later when the zip command wants to run, fails:
zip error: Could not create output file (/var/folders/pD/pDPQGhivGCCVBsrZpH0VaU+++TI/-Tmp-/D6E45F6F-264A-4714-955A-1EC44E78DFC0-246-0000AFED061085C5/mWorkf.ipa/mWorkf.ipa)
When the correct command should have been:
zip error: Could not create output file (/var/folders/pD/pDPQGhivGCCVBsrZpH0VaU+++TI/-Tmp-/D6E45F6F-264A-4714-955A-1EC44E78DFC0-246-0000AFED061085C5/mWorkf.ipa)
Any ideas?
To me it looks like the ipa file is being duplicated when it is being generated. The best thing I could suggest is clearing the archive in the organiser and trying to 'share' the application and re-saving the project.
Also, check all your provisioning profiles are installed in the organiser and the distribution certificate is installed in the keychain because this can also disrupt the exporting of an ipa file.

Command /usr/bin/codesign failed with exit code 1

I am trying to test a app on my phone. I keep getting this error:
Command /usr/bin/codesign failed with exit code 1
I have added the Provisioning profile and went through the set up on the apple iPhone portal.
I have been looking at this for a little over an hour and a half and I still can't figure it out.
Any ideas why this isn't working and why I am getting this error? Thanks!
Edit:
Here's some information on my build:
CodeSign build/Debug-iphoneos/TableView.app
cd "/flashPics_iPhone BACKUP 2:27"
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv _CODESIGN_ALLOCATE_ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
/usr/bin/codesign -f -s "iPhone Developer: Coulton Vento (LVEE98KDSF)" "--resource-rules=/flashPics_iPhone BACKUP 2:27/build/Debug-iphoneos/TableView.app/ResourceRules.plist" --entitlements "/flashPics_iPhone BACKUP 2:27/build/TableView.build/Debug-iphoneos/TableView.build/TableView.xcent" "/flashPics_iPhone BACKUP 2:27/build/Debug-iphoneos/TableView.app"
/flashPics_iPhone BACKUP 2:27/build/Debug-iphoneos/TableView.app: object file format invalid or unsuitable
Command /usr/bin/codesign failed with exit code 1
This is a good resource in figuring out how to setup the provisioning:
http://mobiforge.com/developing/story/deploying-iphone-apps-real-devices
You must download the provisioning profile, the certificate and make sure your iPhone's UDID is registered on those accounts. Then for the Distribution profile you need to specifically tell it in it's setting to use a Distribution Profile to make it build it.
Edit:
Under Project Settings > Select the Configuration your using (Debug, Release, or Distribution) and make sure under Code Signing your Profile appears there.
I fixed that error. The steps are:
GOTO project
select Edit Project setting
in genatel tab project Format select your current Compatible Xcode version and select based SDK for your currunt iPhone Device; for example (iphone device 4.0) then...
build tab:
configuration : Distribution
Base SDK : choose your latest xcode SDK Device
Code signing identity : choose your provisional portal that you alredy created in iPhone Devloper center and you installed so select that particular provisioning.
Any iPhone OS Device : select same as Code signing identity (as mentioned above)
Then next step is go scrolling at below that find Product Name
Product Name : give Product name exactly same as your prodoct name. That's it.
Follow the same steps in configuration :Debug and Release

Resources