Uploading to App Store from a multi-app build - ios

I have an Xcode project with 6 targets. They generate almost-identical iOS apps. I almost always build and upload them together.
I'm trying to simplify that flow somewhat. I've put together a schema that builds all six targets. When I build and archive that schema, I get a line in the Archive window under the schema name, as opposed to individual apps; the "Upload to App Store" button is grayed out on that line. There's "Export", but it doesn't produce IPAs.
Tried a similar approach with a target that lists the 6 apps as dependencies and a schema over that target - same result.
A most welcome side effect of a multi-app build is that common dependency libraries are only built once, not six times over. Time saving is considerable, so I would hate to go back to six separate builds.
Question: what's the right way to build multiple iOS apps in one go? If a multi-target schema is the answer, how can I get them to App Store?

An IPA can be trivially built from an app bundle - just place the bundle into a folder called "Payload" and zip it up. Application Loader will happily submit said IPA to the App Store.
Some claim you can upload via command line, too, but I haven't tried yet. App Loader works.
You can even make preparing the IPAs a part of the build, by providing a post-archival script step in schema properties.
The following shell script will get to the archived products:
Today=$(date +%Y-%m-%d)
XCArc=~/Library/Developer/Xcode/Archives/$Today
ArcName=`ls -t $XCArc | head -n 1`
XCArc=$XCArc/$ArcName/Products/Applications
cd $TEMP
mkdir Payload
cp -r $XCArc/MyApp.app Payload/
zip -r -y -q -9 MyApp.ipa Payload
This picks up the latest archived build from the Xcode archives and makes an IPA under $TEMP.

Related

Xcode not generating all required dSYMs even though Build Settings have Debug Information Format = Dwarf with dSYM

Xcode is generating one dsym, which has the name of my app as the filename (e.g. MyApp.app.dSYM), but it's not generating the other dsyms with the UUIDs that Firebase is constantly telling me that I'm missing. (e.g. 92248A4B-6CA2-3B54-9787-C007E25C018F.dSYM)
I've followed the instructions, but something is still wrong. This was working when we were using Fabric, but since we updated to use Firebase directly, nothing is really working properly anymore.
I've followed the instructions on how to change the Build Settings to make sure the dSYMs get generated, but my Build Settings were already updated like that when I following the migration instructions from Fabric to Firebase. Here is a screenshot of my Build Settings:
Here is a screenshot of my Run Script Build Phase:
In the Archive Build Log, the only reference to generating dSYMs is for the one MyApp.app.dSYM that I get, but I need the others generated too.
GenerateDSYMFile
/Users/kenny/Library/Developer/Xcode/DerivedData/MyApp-dttbmiamkojuotbcyjgzerxhcqun/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Release-iphoneos/MyApp.app.dSYM
/Users/kenny/Library/Developer/Xcode/DerivedData/MyApp-dttbmiamkojuotbcyjgzerxhcqun/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app/MyApp
(in target 'MyApp' from project 'MyApp')
cd /Users/kenny/inaday2/svn-MyApp/trunk/apps/iOS/MyApp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil
/Users/kenny/Library/Developer/Xcode/DerivedData/MyApp-dttbmiamkojuotbcyjgzerxhcqun/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app/MyApp
-o /Users/kenny/Library/Developer/Xcode/DerivedData/MyApp-dttbmiamkojuotbcyjgzerxhcqun/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Release-iphoneos/MyApp.app.dSYM
Settings look okay, attaching the script I am using and process. Hope these info helps.
To have all the dsyms you need to first upload the build to Testflight and then from Tesflight, you need to download the final processed dSYM.zip.
A folder appDsyms.zip will be downloaded, once this is decompressed, you will see list of dSYM's
Post that use below script to upload the same to crashlytics.
So there are few changes done in Firebase Crashyltics the way dSYM mapped to the build we upload.
Initially, there was a manual option as well to upload but now that's abandoned and the only way by running the script from your terminal.
Pods/FirebaseCrashlytics/upload-symbols -gsp YOUR_PLIST_FULL_PATH -p ios ~/PATH_TO_DSYM_ZIP_OR_FOLDER
**Example[Below is my working script to upload dSYM to crashlytics]:**
Pods/FirebaseCrashlytics/upload-symbols -gsp MY_PRROJECT_NAME/Support/Firebase/Prod/GoogleService-Info.plist -p ios ~/Downloads/appDsyms

iOS and FirebaseCrashlytics

I am trying to follow the instructions on Firebase Docs to upload missing required dSYMs. However I am stuck on running the uploader script.
In my build phases I have
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols -gsp${SRCROOT}/GoogleService-Info.plist -p ios ${SRCROOT}/appDsyms"
When I try building the iOS app with this, I get the error:
line 4: /path/to/Pods/FirebaseCrashlytics/upload-symbols -gsp/path/to/GoogleService-Info.plist -p ios /path/to/appDsyms: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
When I try running the script from the terminal I get the error:
No Google App ID or Google Services file provided
I have verified that I have a Google Services file and am able to run my project using other firebase services that rely on it. I used to be able to upload Dysm files directly into the Firebase Console, but that changes on March 1.
Should this command be run as an XCode script or a command from the terminal? And, more importantly, does anyone understand how to resolve this issue?
As of May 2020:
After Fabrics shut down, many developers faced such issues because Fabric was automatically creating the script to upload dSYM files from Xcode and we never pay attention to it.
Now as Fabric is replaced with FirebaseCrashlytics, in order to achieve this automatic mechanism, you can create a new run script and paste this script there:
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
This script will get the dSYM files and upload them to firebase servers so that you can see the crashes.
For multiple Schemes:
If your project has multiple schemes, you can simply create multiple such scripts by changing the path to the Google Plist file.
NOTE: You can also manually upload the dSYM files using upload-symbols tool [Check here], but it's always better to automate the process wherever we can.
EDIT: July 2020:
When you see missing dSYM files for the crash in the Crashlytics dashboard, instead of getting the email for it, you can upload the dSYM file for the build as soon as you submit it for Apple review or for testing via Test Flight.
Missing dSYM is shown because when bitCode is enabled, the App Store Connect process the binary post uploading it and generates a new dSYM file.
You can find the dSYM file from the Activity section in the App Store Connect.
2020 FirebaseCrashlytics solution
You have two solutions :
1) From the command line
Go to your project folder and run :
./Pods/FirebaseCrashlytics/upload-symbols -gsp GoogleService-Info.plist -p ios <path_to_your_dsyms_zip>
You can get your dsym in Xcode organizer > right click on the archive > show in Finder -> Show content -> go to dsymm folder and compress it
2) From Xcode Build Phases
As described here (Firebase doc), you can add a Run Script phase in Xcode with this content :
"${PODS_ROOT}/FirebaseCrashlytics/run"
You also have to add these two input files under the run script :
${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}
and
$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)
After hours of struggling with this problem finally solved it using this approach:
use this command in Terminal: /path/to/pods/directory/FirebaseCrashlytics/upload-symbols -gsp /path/to/GoogleService-Info.plist -p ios /path/to/dSYMs
Important thing is instead of /path/to/pods/directory you should enter the path to your pods folder in your application folder, and instead of /path/to you should enter the path to the GoogleService-Info.plist which is in your project folder too. And the last one is, instead of /path/to/dSYMs you should enter the path to your archive which has the format of .xcarchive.
For finding the .xcarchive path, you should first archive your application, then go to XCode -> Organizer and select your build, then right click on it and select "Show in finder" and then right click on your .xcarchive file and select "Show package contents". This is it, you can copy this path and paste it instead of /path/to/dSYMs and then hit enter to start uploading to Firebase Crashlytics.
Check out this link for more information:
Firebase Docs
While implementing FirebaseCrashlytics(Currently is in beta) for Crashlytics
Add new run script from Build Phases and add the following :
"${PODS_ROOT}/FirebaseCrashlytics/run"
In Input Files sections add
${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}
and
$(SRCROOT)/path to/GoogleService-Info.plist
If you still get dSYM missing error then try to run from terminal
/path/to/pods/FirebaseCrashlytics/upload-symbols -gsp /path/to/GoogleService-Info.plist -p ios /path/to/dSYMs
For path to FirebaseCrashlytics and GoogleService-Info.plist drag and drop from the actual location
For dSYMs path will be ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}
To get that hit the command with your project .xcodeproj and target xcodebuild -project YourProject.xcodeproj -target YourTarget -showBuildSettings
and replace your specific path
Please take note of the following while implementing Crashlytics
1. Run application in release mode
2. While testing disconnect device from mac
3. Set correct GoogleService-Info.plist
4. If you rename it, make sure you set the correct file name whenever required.
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp
"${PROJECT_DIR}/additional_folder/GoogleService-Info.plist" -p ios
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
I replaced my GoogleService-Info.plist in additional folder and made directory changes in shell script. Probably you should do the same
For terminal command you better drag and drop necessary file in terminal then copy selected path
/path_to_pods/FirebaseCrashlytics/upload-symbols -gsp
/path_to_google_service/GoogleService-Info.plist -p iOS /path_to_dSYMs
Believe me, I spent one day but nothing worked,
Surprisingly few solutions are working for a few projects for my colleagues but I'm using Big Sur & Xcode 12.2 nothing worked for me.
Tried 1: Each step mentioned in firebase doc.
Tried 2: Tried to upload symbol from terminal by passing path_to_pod_firebasecrshlytics/uploadsybol -gsp path_to/GoogleService-Info.plist -p ios path_to/dSYMs
But, No luck,
Following trick works for me,
Step 1: make sure you are on the latest firebase crashlytics version for it, give a path to project & fire cmd pod update
I was using Firebase Crashlytics version 4.0.0-beta.1 but after pod update it is 8.2.0
Step 2: Go to build phase add a run script bellow compile bundle resources "${PODS_ROOT}/FirebaseCrashlytics/run"
Step 3: Add DYSM Script, "${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/your_path/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
Step 4: Build project;
Step 5: Run project & Stop or disconnect from storyboard
Step 6: Make crash 2-3 times & wait for 2-5 mins.
Cheers, All Set!
We can do:
PATH_TO_GOOGLE_PLISTS="${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist"
To get a reference to the plist
Then use it:
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PATH_TO_GOOGLE_PLISTS}" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
Your Google Services path seems to be off. Here is an example of what my build phase looks like, which is able to successfully upload dSYM's. I suggest following these instructions one more time https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports-new-sdk?platform=ios&authuser=0.
find /Users/okodysh/Library/Developer/Xcode/DerivedData/myApp-ftqksfkpdvisbtaozpqzzjiizpfk/Build/Products/Debug-iphonesimulator -name "myApp.app.dSYM" | xargs -I {} $PODS_ROOT/FirebaseCrashlytics/upload-symbols -gsp /Users/okodysh/Desktop/iOSApps/myApp/myApp/GoogleService-Info.plist -p ios {}
Finally, I've figured it out and wrote a shell script to handle all this for me
Feel free to to use it: https://github.com/cs4alhaider/firebase-upload-symbols
Hmm nothing worked for me but changing this:
"${PODS_ROOT}/FirebaseCrashlytics/run"
to this:
"${PODS_ROOT}/FirebaseCrashlytics/run" -gsp "${PROJECT_DIR}/project_main_dir/google-services-files/iOS-GoogleService-Info.plist"
EDIT:
for those of you trying to complie to iOS's Catalyst:
you don't have to download two different Google JSON files. You should use only one (cause you have only 1 target). IF you want to upload a mac version of your app, just go to App Store Connect and create a new release for OSX (in the same page of your app)
In my case none were working until I added this:
"${PODS_ROOT}/FirebaseCrashlytics/run" -gsp "${PROJECT_DIR}/intermediate_folders/GoogleService-Info.plist"
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/intermediate_folders/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
If I didn't add the path to the run command, the build phase would be running forever...
Check you FULL project folder path whether it contains space. I solve it by moving my project into another folder path that doesn't have space.

Submit iOS Build to Facebook from Xamarin.Form

I made a Cross platform app using xamarin form , I uploaded the android version to Facebook review team and I need to do the same for the iOS version, the instructions says you need to zip the file by using:
ditto -ck --sequesterRsrc --keepParent `ls -1 -d -t ~/Library/Developer/Xcode/DerivedData/*/Build/Products/*-iphonesimulator/*.app | head -n 1` path/to/YourApp.zip
to zip the build found in Xcode derived data , anyway my Xcode derived data doesn't contains the Build folder(that's because I am using Xamarin?) referred in the comand line, what i have to do? I didn't found any tutorial to achieve this in xamarin form.
It seems the code above wants to compress a set of .app files. You could find the files under Xcode/DerivedData if you use XCode to build the project. But if you use Xamarin to develop applications, there won't be corresponding files in the folder.
However, you can find the files in the path: YourProjectPath/bin/iPhoneSimulator/Debug. Then at last, you could make the .zip file using the path above.

Packaging a BlackBerry (WebWorks) PhoneGap/Cordova application

I'm working with PhoneGap/Cordova and the only options I see is to build to the emulator or to build for debuging to the device.
I want to package the app for further distribution and publishing. Any thoughts?
Thanks!!
First build with
ant blackberry build
Then, you need to get and install signing keys:
https://developer.blackberry.com/html5/documentation/signing_setup_smartphone_apps_1920010_11.html
Then finally, once you are able to code sign you need to use bbwp to sign and package the zip file generated by the build (the zip is in the build directory of the PhoneGap folder). So navigate to your sdk/bin directory and run:
bbwp C:\myapp\HelloWorld.zip -g mypassword -o C:\myapp\signed
This generates two folders in C:\myapp\signed which contain the signed files. You will need different files depending on the distribution method and a summary is here:
https://developer.blackberry.com/html5/documentation/distributing_your_app_1866990_11.html
https://developer.blackberry.com/html5/documentation/signing_landing_page.html
https://developer.blackberry.com/html5/documentation/distributing_your_app_1866990_11.html
You need to get a signing key from RIM in order to publish your apps to the Blackberry App World. My previous experiences was packaging the app with signing key and allow others to install the app with BlackBerry Desktop Manager using the .alx file generated.
cd into the top level directory of your project (the one that contains the www/ folder). Then call this command:
ant TARGET build
Where TARGET can be blackberry, playbook, or qnx (beta right now). This will create a build/ folder which should contain the needed files for further packaging.

How to fully automate from build to .ipa file in xcode 4

In xcode 3, using a bash script, I could run xcode from the command line, then take the files in the build directory and zip them up into a .ipa file, allowing for a fully automated build process for my adhoc iOS distribution. Anytime there is human intervention, there is the possibly for error.
Under xcode 4, this seem to be not possible anymore. The build directory has been replaced with a DerivedBuilds folder and it uses some obfuscation naming, so it's not possible to let an external script find the files.
In xcode 4, after the build, I need to run Produce->Archive, then selected the file in the organizer, then select save, then navigate to the final folder and name the file and hit save. This is a very error prone process better left to machines.
So, is there a way to go from a clean build all the way to a signed .ipa file? I've got to believe this is possible, there is no way people with automated build processes are having to do this step by hand.
Does anyone know how to do this?
Sure, the script I have been using in my continuous integration environment is available at https://gist.github.com/949831 That might do more than you need but should be able to serve as a base for whatever steps you want to include in your build process.
As you noted it would be hard to predict the derived data path Xcode will use but it is not too hard to located it in the build output as part of the build script.

Resources