How to define a output name for flutter build ipa? - ios

I could not find a parameter to define the output filename of the ipa file. Is there an easy way to set the ouput filename?
I use an azure pipeline to build my ipa file:
- script: flutter build ipa --export-options-plist=ios/exportOptions.plist --build-number=$(Build.BuildNumber)
displayName: Build iOS adHoc
I want to generate 2 ipa files. One for the AppStore with an AppStore profile and one with adHoc Profile. For that i want a second command but i cant find an easy way to declare a filename so i can have both files generated.

I was looking for this as well. There is a note about it here.
https://flutter.dev/docs/deployment/ios
Note: When you export your app at the end of Distribute App, Xcode
will create a directory containing an IPA of your app and an
ExportOptions.plist file. You can create new IPAs with the same
options without launching Xcode by running flutter build ipa
--export-options-plist=path/to/ExportOptions.plist. See xcodebuild -h for details about the keys in this property list.

Related

Which IPA build is correct for App Store?

I have noticed that there are 2 ways to create IPA for App store.
1- Create Runner.xcarchive file and then with Xcode export IPA file.
2- When you're creating Runner.xcarchive file, flutter creates an IPA for you as well(Flutter command: flutter build ipa). example: 👇👇👇👇
project-app % flutter build ipa
💪 Building with sound null safety 💪
Archiving com.example.app.dev...
Automatically signing iOS for device deployment using specified development team in Xcode project: *********
Running Xcode build...
└─Compiling, linking and signing... 13.6s
Xcode archive done. 62.4s
Built /Users/user/StudioProjects/project/app/build/ios/archive/Runner.xcarchive.
Building App Store IPA... 20.8s
Built IPA to /Users/user/StudioProjects/project/app/build/ios/ipa.
To upload to the App Store either:
1. Drag and drop the "build/ios/ipa/*.ipa" bundle into the Apple Transport macOS app https://apps.apple.com/us/app/transporter/id1450874784
2. Run "xcrun altool --upload-app --type ios -f build/ios/ipa/*.ipa --apiKey your_api_key --apiIssuer your_issuer_id".
See "man altool" for details about how to authenticate with the App Store Connect API key.
If I use the IPA that Flutter provides in the second option, is it the same as the first way?
Yes, creating an .ipa file using either of the methods you described should result in the same file.
To create an .ipa file using the first method you described, you would first need to build an .xcarchive file using Xcode. Then, you can use Xcode's "Export" feature to create an .ipa file from the .xcarchive.
The second method you described involves using the Flutter command flutter build ipa to create an .ipa file directly. This command will create an .ipa file that can be used to distribute your Flutter app on the App Store.
In both cases, the resulting .ipa file should be the same and can be used to distribute your app on the App Store.

Flutter - Generate .ipa file

The official Flutter documentations says that the following command produces both ipa and xcarchive files.
flutter build ipa
From the Flutter documentation to generate ipa
Run flutter build ipa to produce an Xcode build archive (.xcarchive
file) in your project’s build/ios/archive/ directory and an App Store
app bundle (.ipa file) in build/ios/ipa.
However, the command is generating only .xcarchive file. How can we generate the .ipa file? Looks like we can generate from Xcode Export but trying to look for a command line command to generate .ipa file to integrate into CI/CD solution.
You can generate .ipa file for distribution using Xcode via following steps
1.Open iOS folder of your project in Xcode
then Product -> Archive
It once this is complete open up the Organiser and click the latest version.
3.Now click on Distribute App This will open list of method for export. Select the export method as per your requirement (In your case i think you want to distribute app for testing) so select Development option and click on Next button.
4.Now it will ask for app thining and re-signed for development distribution select Automatically managing signing it take some time to generate .ipa file after that you can export .ipa file in your desire location.
When you run flutter build ipa, it generates a Runner.xcarchive and an IPA.
Output of flutter build:
Xcode archive done. 65.6s
Built /Users/user/repos/app_name/build/ios/archive/Runner.xcarchive.
Building App Store IPA... 64.5s
Built IPA to /Users/user/repos/app_name/build/ios/ipa.
The generated file is called app_name.ipa.

Generating an IPA file for a flutter project without a paid dev account

so I just finished a Flutter mobile app and I want to install on my personal iPhone. I know about the 7 days restriction, but buy an apple dev account for 99$/year was a bit too much for me so I used an external service. You pay them a lil bit of money and give them your iPhone's udid and they give you back the certificate and provisioning profile files and you can use an external signer to sign your apps. I have already done this for an app of mine a few month ago. But now I'm struggling with generating the ipa.
How can I generate the ipa file with the free apple account?
He again, so the way to generate an unsigned flutter ipa is by first going to Xcode and changing the build configuration of the scheme to Release :
Click on Runner, and Edit scheme
Select Release for the Build Configuration of the Run schema
And then on the terminal in Android Studio run the following command :
flutter build ios --release
This will take a minute or two and when it's done go to this folder : your-app/build/ios/Release-iphoneos and you should find your runner.app file. Create a folder named PayLoad next to it and copy and paste the runner.app file inside this folder. After that you wanna compress your Payload to get a new file named Payload.zip. Change its extension to ipa and you're done.
You can now use whatever you want to codesign this ipa file.

Remotely create iPA or archive build

How can I create iPA or Archive build without using xcode.
Schene - User can generate iPA from web app.
I know user can generate iPA using command line , But user should have xcode in his local machine then only he will be able to do it.
But i want to generate iPA remotely , Where user not have xcode.
He will have Git link (where entire project is available)
Another query
Currently user can archive or create iPA from local xcode project. I want to generate iPA directly from source code url (git/SVN). Is this possible ?
is it possible to do it without using jenkins or Fastlane
You can use a something like Jenkins to pull from the Git link and compile the project. The easiest way to do this is to combine Jenkins with Fastlane.

iOS Enterprise: Re-certify existing IPA with new certificate

We are enrolled in the iOS Enterprise Program. The provisioning profile used for our released apps is about to expire, so I got a new certificate and provisioning profile.
I need to re-distribute some of our apps with the new provisioning profile, without building them anew. How?
(I vaguely remember seeing a utility program that did exactly this: You choose an IPA and a provisioning profile, and it would create a new IPA using the new profile and certificate. What was the tool’s name, and where can I get it?)
In theory whoever built the last IPA in XCode should have used Archive - this creates a build you can sign to create an IPA (using XCode).
You could also try using the command line signing tool XCRun to re-sign the App bundled in your existing IPA:
http://skabber.com/package-your-ios-application-with-xcrun
OK, turns out when you know what term to google, there‘s lots of excellent resources…
They all point to xcrun. I made it work with this shell snippet, adapted from this promising build script:
APP_FILENAME=MyApp.app
BUILD_DIRECTORY=/Path/To/Target/Dir
IPA_FILENAME=MyApp.ipa
DISTRIBUTION_CERTIFICATE='iPhone Distribution'
PROVISIONING_PROFILE_PATH='/Path/To/Profile.mobileprovision'
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "$APP_FILENAME" -o "$BUILD_DIRECTORY/$IPA_FILENAME" --sign "$DISTRIBUTION_CERTIFICATE" --embed "$PROVISIONING_PROFILE_PATH"
The codesign command-line utility, included with the iOS SDK tools, will allow adding/changing the certificate and provision with which a developer built app is signed.
As hotpaw2's anwaswer states. You can also resign using the codesign tool.
The way I do it (this may not be the most efficient, but it works)
Rename the .ipa to a .zip and extract
Run The following:
/usr/bin/codesign -f -s "iPhone Distribution: Company Name" "Payload/MyApp.app"
Re-zip the Payload folder and rename to .ipa
Note: You can also use this method to edit the embedded.mobileprovisioning file! Just remember to remove the .DS_Store (rm Payload/.DS_Store) if you are using finder.
You can do manual way if you just resigning app from same account with following steps.
All this is using shell script and super easy provided you know how to use shell commands.
Rename IPA to zip
unzip this file to temp folder
Remove the old _CodeSignature folder from all targets (if you have multiple targets like main,watch, watch extn, siri, widget, message, etc)
bring all the targets prov-profiles in one folder and replace all the embedded.provisioningprofile files for each target with the new ones
remove the archived....xccent file as this is old one (optional)
code sign with the entitlements.plist created for all the entitlements if any used by the app.
Zip the folder back after code sign all okay with no errors
Rename the zip to IPA
Note: To validate the IPA before upload to apple you can just use the altool from inbuild XCode App Loader to check the new IPA.
Reference: The steps for commands is also explained here:
http://www.enterpriseios.com/forum/topic/Resigning_3rd_party_apps
If you want to get rid of manual sign use the fastlane tool as its quite simple and easy to configure.https://fastlane.tools/

Resources