How to build an iOS AdHoc app with flutter - flutter

I have an flutter app for ios and can build it for the app store using:
flutter build ios --release
But how can I build an Ad-Hoc app for ios?

Pre-requisite
Apple Developer Program membership ($99/year)
Distribution certificate added to your machine
In the Xcode project (Signing & Capabilities tab), select your team/ developer account which has the Apple Developer program membership.
1. Create an Archive (.xcarchive)
Technically you do not build an Ad Hoc app, you build a debug/release/profile app, which you then distribute via a distribution method, one option is Ad Hoc.
Using command line: You can run flutter build ipa to build the xcarchive. Then it should show a URL for your Runner.xcarchive at the output (double click that link), or
Using Xcode: Open the Xcode project, and in the menu bar, click Product > Archive. The organizer window will open once the archive is complete.
2. Create an .ipa
Now the Organizer window should be open. Press the Distribute App button: you should see multiple options. You can share the .ipa file with users, and they can install it onto their iPhone:
It's worth noting you can also create an .ipa using xcodebuild, but when you're first learning, it's nicer to use Xcode.
3. Install the .ipa on a device.
I wrote an answer about that: https://stackoverflow.com/a/68968301/7365866
Reminder
Just remember to do this:
Action Required: You must set a build name and number in the pubspec.yaml file
version field before submitting to the App Store.

You can use Code Magic's CLI tool to achieve that.
On their CLI (locally installed or on your CI server), there is an option to add
--type IOS_APP_ADHOC
See at the end of their signing documentation section for Specifying code signing configuration

You can use --export-method in the flutter build command, example:
flutter build ipa --release --export-method=ad-hoc

For Someone out there, who have trouble building ios application since they don't have an apple developer account, here's a method that i do and i use.
1st if you are an ios user you can connect your ios device into your mac and do a flutter run --release. you can also do it with just the simulator too and it does works the same.
Now, the ios app is created, using your 7 days free trial developers provisioning profile, what we need is to use some programs likie imazing,apple configurator or itunes, to get the ipa from inside the app.
Now you have build the ios app with a release version, and you can redistribute it with just a 7 days free trial version of yours.

Related

How to distribute iPad app as in-house app?

I developed some 3 apps for my organization and we want to distribute it to some 30 iPads in the office. I am tying to find a step by step process to do it. But didn't find any so far. The methods I tried and failed are the following,
I took the app (with .app extension which can be found in ~/Library/Developer/../IOs_Release) and provisional certificate and dropped them in iTunes library. After that I connected a new iPad (not a registered as development device) to my mac book. Through itunes, I tried to sync the app. But an alert appeared on the ipad showing "xyz app is failed to install"
I tried the ad hoc distribution. First I archived app in the xcode archive and clicked distribute button. A wizard appeared asking for what kind of distribution do I want. I selected ad-hoc distribution and it automatically selected my iPhone distribution certificate and processed and gave me .ipa file. I tried installing it in the iPad by itunes sync and it gave me same error.
It would be great to get steps for in-house app distribution since they are nowhere to be found.
Check out my answer to another person's SO question HERE
This assumes that your organization is setup with an Enterprise developer account.
There is a project called iOS Beta Builder, check the below links:
Introducing iOS Beta Builder
iOS Beta Builder GitHub page
iOS Beta Builder Mac AppStore
The provisioning profile used for the adhoc build must have a reference to the 30 devices.
Go to the Provisioning Portal and add all 30 devices under the Devices section.
Then add those devices to the adhoc provisioning profile (Provisioning, Distribution).
Once added, download the updated provisioning profile and install it in Xcode. Delete any previous profile.
Build and Archive the app. Make sure the archive build is properly setup to use your adhoc provisioning profile.
Use the Organizer to save the ipa file from the archive build.
Drop the ipa file into iTunes. Now sync each of the 30 devices to include the app.
Xcode - Product -> Archive
Distribute -> (Select) Save for enterprise or Ad-Hoc Development (Next)-> Code sign identity (select your profile)-> save File on disk -> distribute project.ipa file.

Error installing iOS app with Ad Hoc Profile

I have finished developing a big and heavy app. It is universal (for iPhone and iPad), and now I am trying to publish it in App Store. I have done this other times, so I know how annoying it is.
I'm using Xcode 4.2 and devices with many iOS versions (4.2.1, 5.0, 5.1). My app is enabled to send Push Notifications, and it doesn't use iCloud.
I have tested it with development certificate, and it works OK. Now I've generated and downloaded Ad Hoc Distribution Provisioning Profile in order to test it in my iPhone and iPad. It seem like all is OK, but when I'm going to install the app (with the Ad Hoc Distribution Provisioning profile) with Xcode in any device, Xcode shows an error: "Error launching remote program: failed to get the task for process".
I've read this link it suggests two causes:
I am using Ad Hoc Distribution Provisioning profile when debugging the app in my device. This is not the problem, because I'm not debugging the app.
I specify a code signing entitlements property list in my build settings which does not include a "get-task-allow" or "Can be debugged" property. This is not the problem, because I'm not specifying any entitlements property list because I don't need it (or I think so).
Some people that have the same problem solve it adding the "get-task-allow" property to the entitlements property list. But I haven't that file. So the question is, Do I need to create it just for add the "get-task-allow" property?
If I don't , which is the problem? I'm not trying to debugging and I haven't entitlements p-list in my app.
Although my app doesn't need entitlements p-list, I tried to create it and add the "get-task-allow" property in OFF following this, but it didn't solve the problem.
I have also to say that althought Xcode shows the error during the installation in the device and the app shut off, when I start again the app, the installation is done and the app runs without problem.
I read the following similar thread, but they didn't solve my problem:
iPhone Debugging: How to resolve 'failed to get the task for process'?
Profile bug (Error launching remote program: failed to get the task for process XXX.)
iPhone Debugging Error launching remote program: failed to get the task for process 907
Error launching remote program: failed to get the task for process 699
Thank you so much.
I am using Ad Hoc Distribution Provisioning profile when debugging the app in my device. This is not the problem, because I'm not debugging the app.
This is exactly the problem.
You are trying to run an ad-hoc application from the XCode - it means to debug it.
You should archive your app and install it (an ipa file) together with the correct provisioning profile.
There are few ways to install the app:
Using iTunes - not trivial
Using an iPhone Configuration Utility - easier
Using some OTA (over the air) installation service (e.g. TestFlight site) - I use this all the time, after a couple of times it gets really easy and you can distribute your Beta version to remote devices (e.g. clients, friends etc.)
The problem look like you are running App from Xcode with Ad Hoc Distribution Provisioning profile.
After Archiving (Product menu > Archive ) the App from Xcode, you can get ipa.
You can install ipa via iTunes if you device already sync with your iTunes app.
https://testflightapp.com/ , I am using testflightapp for testing the app. It's easy to use and we can distribute to for test user.

How to configure a Xcode project for beta testing with TestFlightApp?

I signed up for TestFlight.
Then I followed all steps in this tutorial:
But Xcode throws this warning:
Application failed codesign verification. The signature was invalid,
contains disallowed entitlements, or it was not signed with an iPhone
Distribution Certificate. (-19011)
It smells like there is a lot more work to do than what they wrote in the tutorial.
Is there a complete tutorial which walks through every step without stepping over anything?
And do I need to add the SDK even for simple beta tests?
(Edit: No, SDK is not needed!)
Start with logging into the Provisioning Portal, and adding a test device or two, under Devices. Then go to Provisioning and create a new one for the appID you are working on and add those devices.
Back to Xcode and use the Organizer:Devices:Provisioning Profiles to download (refresh) the Provisioning Profile. Set your project's Debug scheme's signing to use that developer profile. You should then be able to build and then archive. Once archived, do an ad hoc distribution and save off that file to the desktop.
Go to your account on TestFlightApp.com and press the Upload Build button. Drop the file you saved on your desktop, into the Build upload area. TestFlightApp will give you errors if the app wasn't bundled for adhoc or signed properly.
Now, here is where TestFlightApp.com will save you work. Send out invites to friends from within TestFlightApp.com. TestFlightApp.com will manage notifying them and as they create an account, it will also help them find their UDIDs. These UDID's can be batched up and later downloaded by you and re-uploaded to the Apple Provisioning Center, into your devices section.
You then use Xcode to refresh your profiles, and rebuild the app, archive, and upload to testflightapp. Then you can select which one of your testers will get to see this build and what message they should be sent. Your testers will not have to figure out how to download the files and install them using iTunes or other app, they merely press the install button.
Believe me, while it is still a bit of work, it is so much better than not using TestFlightApp.com, especially if your users are not very savvy about app installation. In the future, you can use the TestFLight SDK to gather crash reports and usage information for your debug builds.
See the following for some more info: TestFlight beta-testing iOS app

iPhone App:Test the newer version of app first and after make it available for other users for download

I have an iPhone App which is available on App Store.
Now I have made some changes in my existing App which can be tested only when an App is available on App Store.
So I want to release newer version but I want to test it first before it it available on App Store for all users
And once it is tested and if it works fine as per expectation then only I want to make it available for other user.
How can I do that?
The short answer is: NO - there is no way to make an app available on the app store that only you can download and test.
If you can specify exactly what it is that you are trying to test that only works when the app is live, we may be able to suggest a different approach.
EDIT: if you just want to test the upgrade process, you can just install the new version on top of the old one - there's no need to delete the one already on the phone. For example if you download the version from the app store, run it, and then build and install a version from Xcode, it will install on top of the app store version, and keep all the settings and documents from that version, just like if a user was upgrading.
Also read up on "wireless distribution" for adhoc apps. Using wireless distribution, you can download and install the app from a link on your phone, just as if you were doing it from the app store, except the link will only work for UDIDs that were included in the adhoc profile.
Two choices:
OTA AdHoc Distribution
Set up over-the-air Ad Hoc distribution. These guys can help: https://testflightapp.com/
A user can install an adhoc build over an appstore build without deleting data, and vice-versa.
Side-by-side Builds
Ok, so your question is about side-by-side installation: you want a user to have the real app and a test version on the phone at the same time. To do that you just need to create version of the app with a different bundle Id. So if your app is com.myco.MyApp, create a copy of it as com.myco.testing.MyApp. Then use Ad Hoc distribution (or whatever) to get it to testers.
I've got a build script that updates the bundle version with the build number. I'm actually just about to update the script so that it will modify the bundle Id so I can have side-by-side testing. This is what I do for the bundle version on my build server:
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion '${PROJECTBUNDLEVERSION}'" $PROJECT/Info.plist
Presumably can do something similar for the CFBundleID:
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier '${PROJECTTESTBUNDLEID}'" $PROJECT/Info.plist

Building iPhone App for Distribution

I have a question on how exactly to do the final distribution build for my app. I have actually successfully built this app already but now I am trying to make an updated version and to remember what I did right the first time. It all seemed to go wrong when my provisioning profile expired....
Anyway, I have my distribution certificate and distribution provisioning profile. I have followed the instructions from Apple, an iPhone programming book and several online sources to create a build that checks against the right certificate etc. But the build always fails unless I connect a device, which is strange as the distribution provisioning profiles do not allow the inclusion of a device (which makes perfect sense in itself). However when I build with a device connected I am asked
'Can’t run XXX on the iPod “iPod
touch”
The iPod “iPod touch” doesn’t have the
provisioning profile with which the
application was signed.
Click “Install and Run” to install the
provisioning profile XXX on “iPod
touch” and continue running XXX.'
When I click install and run it fails with the message that
A valid provisioning profile for this
executable was not found.
So my basic question is how exactly should the final distribution build be done? An new executable appears, but it has a forbidden symbol on top of the application icon suggesting the build was unsuccessful.
Any help massively appreciated.
Don't click "Build and Go".
Either just build, and then locate the app and upload it, or use Xcode's "Build and Archive" option.
It is best to use "Build and Archive" as Xcode will look after the app bundle, and the important .dSYM file which is used to symbolicate crash reports for your app.
And you cannot upload and execute app that signed with 'Distribution' certificate on your device. Such app can only be uploaded to AppStore.