Cordova Build Creates xcarchive not an ipa. Why? - ios

I am using Cordova to create and build my application. Today (12/12/17), I am using the current version of everything (cordova, xcode, etc). When I run:
cordova build ios --device --release
at the end of the build process that happens, I get no errors. But I do get this message:
Exported myappname.xcarchive to:
/Users/.../platforms/ios/build/device
** EXPORT SUCCESS **
I don't see anywhere in build logs that a .ipa file was created. Just a stupid .xcarchive.
Note: I cannot to edit project information or settings in XCode manually, because I am running this Cordova command as part of automated build process. I should be able to create an .ipa via Cordova CLI, without having to open XCode.

If you're having the same experience I did, check the actual physical directory for the .ipa file. Turns out even though my build log never said so, the .ipa file was actually being built alongside the .xcarchive. It should be in /platforms/ios/build/device/myappname.ipa.

Related

Upload dSYM files to Firebase Crashlytics without having GoogleService-Info.plist files

In order to enable Crashlytics for my Flutter app (with 3 flavors) i would like to know how the repeating upload of the symbols for the iOS project can be done when i configured Firebase in dart-only mode (i.e. i didn't have to download the GoogleService-Info-plist files for my 3 flavors)?
I've read that i could enter scripts for the upload in XCode under Targets Runner --> Build Phases
...but i wonder how i could differentiate between my 3 flavors, i.e what upload scripts are called if i e.g. build for staging environment?
Also it would be interesting to know if those symbol uploads would happen as well when i build/run the app in my Flutter IDE (IntelliJ).
When using Crashlytics with Flutter, the Crashlytics SDK is integrated using CocoaPods. Because of this, this would be the run script you should be using for your app:
"${PODS_ROOT}/FirebaseCrashlytics/run"
In this case, the script will try to locate the configured GoogleSErvices-Info.plist. However, you can pass the app ID as argument and in that case, the plist file is no longer required.
"${PODS_ROOT}/FirebaseCrashlytics/run" --app-id <your app ID>
You can find the app ID in your Firebase project settings.
I'm not sure how your project is configured, but you would need to run this command for your flavors or targets.
Lastly, when building the app, I believe that Flutter will invoke the Xcode builder, which should execute the run script too.

What exactly does Flutter build iOS do? Is this really necessary?

I would like to fully understand this command and what happens behind the scenes. Here are a few pieces of information I've understood so far but somehow I cannot connect the dots:
When deploying an iOS we need to go through these steps:
build a flutter app in release mode, which will make an .app file/folder
archive & sign the .app file which will convert it into .ipa
send the signed .ipa to the appstore
flutter apps can have 3 modes: 1. debug 2. release 3. profile
running flutter build ios creates a build/ios folder, including the Release-iphoneos/Runner.app
Xcode creates its own .app in ~/Library/Developer/Xcode/DerivedData/Runner-...
Now, questions:
Is the build/ios/Release-iphoneos/Runner.app that Xcode converts into .ipa? I'm asking since I know that Xcode creates its own .app in ~/Library/Developer/Xcode/DerivedData, so I'm not sure if Xcode just copies build/ios/Release-iphoneos/Runner.app in here: ~/Library/Developer/Xcode/DerivedData/ or not
What happens if I don't run flutter build ios before? Will Xcode use only a debug mode of my app? If so, how come it removes the debug flag in the upper right corner?
When I clean my build folder in Xcode (shift+cmd+K) and then I archive the app and it will still build a new .app and then it converts it to .ipa. What mode was this .app created in? Was it a release app? If so, again, why is it necessary to run flutter build ios before and why not just archive it from the Xcode?
Thanks to everyone who tries to unleash this big mystery for me and for everyone else wondering.
The reason you should run a flutter build ios before archive is because archive uses the last build configuration from the results of running flutter build ios.

Unable to build app for iOS, "unable to write module session file Session.modulevalidation No such file or directory"

yesterday I was working fine with Flutter, now i'm facing this issue and I already search everywhere for a solution but no success.
When I run:
flutter run
The build process starts and when its about to finish the error below is shown:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Xcode build done. 12.3s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: unable to write module session file at '/Users/hencke/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation': fopen(/Users/hencke/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation, wb): No such file or directory (2)
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
Exited (sigterm)
Looks like the process is trying to open this file Session.modulevalidation for writing, but this file really does not exist in that folder. And I don't know what to do.
Things that I already tried:
Reinstalling xcode
flutter clean
Clone my project again in another folder and try to build, but same error
Created a new flutter dummy project and tried to build, still same error
Rebooting machine several times
Give permissions to Staff to the DerivedData and ModuleCache.noindex folders
Deleted the DerivedData within hope that xcode build will recreate all the files needed, but, it created everything again but not that particular file.
So that's it, If any blessed human know how to 'recreate', or reset, clear some cache, I would be very thankful.
Before running your project, check everything is checked when running:
flutter doctor
and also make sure at least a device is connected or open iOS simulator first. You can check if flutter is successfully connected to the device by:
flutter devices
when you make sure that flutter detect your device or the simulator, then run your application by:
flutter run
After hours I finally found the solution as it follows:
Without any hope I opened my flutter project with Xcode, and then tried to build the Runner target from there, same error.
Then, I was browsing the Xcode preferences and something caught my attention, on Locations section I found something about DerivedData location, it was set as Default. So, I changed from Default to Custom location and I set to a new folder on my home directory:
Then immediately Xcode created the entire DerivedData/ModuleCache.noindex folder and with them, the Session.modulevalidation file as well.
Then I closed Xcode and tried flutter run again, and it was successfully build!
I'll let this answer to those who may come here for help.

Is it possible to install a ".app" build file to an iPad from within Xcode, without loading the actual project file?

Without actually loading my .xcodeproj into Xcode, is it possible, from the Xcode app, to start an app install to my iPad using the .app file only, which was generated in an earlier build?
This is my last line of inquiry... I'm just looking at potential options because I don't have a paid developer account (yet) and might try to use Teamviewer to log into the remote client Mac to install via Xcode, but do not wish to reveal my project file/code on the remote machine. Installing from within Xcode purely using the .app file would solve my problem, if possible.
I managed to work out a way to do it using this, this, and this. You will need the XCode command line tools, which come as part of the App Store XCode install, or you can get the command line tools only from here.
First up, download and install npm. Then install ios-deploy from the terminal,
sudo npm install -g ios-deploy --unsafe-perm --allow-root
If you need to build from the command line, make sure you have a working XCode project which builds as you want, open a terminal and go to the directory with your .xcodeproj inside, then type:
xcodebuild -list -project <NAME>.xcodeproj/
xcodebuild -scheme <SCHEME NAME> build
Then, or if you've already built in XCode and just want to deploy your .app file to the iOS device, type:
ios-deploy debug --bundle <APP PATH>
You can change debug to release, or either way it will use whatever you set your XCode build configuration to be I think. The <APP PATH> location depends on your XCode install, but the most recent location (I think) is
~/Library/Developer/Xcode/DerivedData/{app name}/Build/Products/Deployment/
This will install your .app onto the iOS device from the command line, and you don't need to load XCode up, or expose your source files. Just requires the .app file. For me, this is a potentially useful way to install an app remotely on a client's device without the need for a paid developer account.

ERROR ITMS-90680: "The binary you uploaded was invalid.”

trying to validate iOS app but got ERROR ITMS-90680: "The binary you uploaded was invalid.”
had tried adding run script at build phase but no luck, any ideas?
Check , you've already uploaded another app version to the store, now you'll need to create a new version and upload that.
have you build your application for release. To do that the command is
tns build ios --release --for-device
More info about the build command (and any other command) can be seen via
tns build ios --help
If this does not resolve your case, please verify that you have gone through the steps described in publishing for iOS and also send us the content of your package.json file.

Resources