Build IPA from .APP bundle without xcworkspace - ios

There used to be a way to build an IPA from an .APP bundle using xcrun but Apple, for some reason, has deprecated PackageApplication. I'm left only with xcodebuild, which requires an Xcode workspace file. My .APP wasn't created via xcode. It was made with Visual Studio for Mac with Xamarin. I can make an IPA by exporting an archive from the IDE but what I'm trying to do is build the IPA from the command line and sign it. The signing part is very straightforward but I don't know how to build the IPA without ZIPping it manually, adding in the embedded.mobileprovision, etc.
Is there an alternative to xcbuild PackageApplication that I can use?

I'm trying to do is build the IPA from the command line...
You can use msbuild to build/package an .ipa
/Library/Frameworks/Mono.framework/Commands/msbuild \
AStackOverflowSolution.sln \
/p:Configuration=Ad-Hoc \
/p:Platform=iPhone \
/p:BuildIpa=true
re: Building via the Command Line (On Mac)
For Windows, include the ServerAddress and ServerUser of your macOS build system
/p:ServerAddress="192.168.40.40"
/p:ServerUser="YourmacRemoteSSHuser"
re: IPA Support in Xamarin.iOS

Related

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.

Fastlane gym export .app

On the gym description says: gym builds and packages iOS and macOS apps for you. It takes care of all the heavy lifting and makes it super easy to generate a signed ipa or app file.
I can't search in documentation how to export .app file. I need the .app file and path to start the calabash tests in my jenkins CI.
We are planning on supporting .ipas in the Calabash iOS tool chain. Until then, use ditto to unzip the .ipa.
$ xcrun ditto -xk path/to/Your.ipa ./
$ mv ./Payload/Your.app path/to/somewhere/else

Xamarin: Generate xcarchive from command line

Is there a possibility to directly generate a xcarchive file from the command line? So that you can generate an AppStore build with a CI tool like Jenkins?
With Xcode it seems you can, but I'm using Xamarin Studio on Mac. Anyway is this possible? Or can you manually create an xcarchive file with the app, dsym and plist?
On my build server I use the following commands to create an AppStore signed ipa file from an archive.
/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool -v build "--configuration:AppStore|iPhone" -p:RssReader.iOS Apps/RssReader.sln || exit 1
# transform the archive into a .ipa package
xcrun -sdk iphoneos PackageApplication -v "${WORKSPACE}/Apps/RssReader/iOS/RssReader.iOS/bin/iPhone/AppStore/RssReader.app" -o "${WORKSPACE}/Apps/RssReader/iOS/RssReader.iOS/bin/iPhone/AppStore/RssReader-${BUILD_NUMBER}-appstore.ipa"

Create .ipa using multiple targets

Currently I'm using a bash script to build and archive our iOS application. With the introduction of "Watch" I have found that my script is no longer able to create the necessary .ipa file as it once did.
The build would generate a single .app file which I would use XCRUN to invoke PackageApplication in order to create the .ipa. Now I'm looking to archive 2 .app files along with 1 .appex file.
Has anyone been able to successfully create an .ipa file via command line/script with multiple .app files?
Using Xcode 6.2
Update
Now using Xcode 7 GM along with OSX 10.10.4.
For "TEST" builds I had a difficult time with developers always changing the profiles so I made 2 builds; one from the command line and the other via the IDE (Xcode). I changed the .ipa extension to .zip and compared the 2.
The good build from the IDE had generated a file called "archived-expanded-entitlements.xcent" which had all the signing identities defined correctly.
I copied this file out to a different directory and use it to inject with all other subsequent builds. The builds now are able to be loaded on the phone & watch for testing.
Below is an example of how to do it. A bit of a hack but it works.
security -v unlock-keychain -p "password" "keychainPath"
xcodebuild -configuration Test -scheme YourAppName -archivePath somePath/YourAppName.xcarchive archive
xcodebuild -exportArchive -exportFormat IPA -archivePath somePath/YourAppName.xcarchive -exportPath somePath/YourAppName.ipa
unzip -o somePath/YourAppName.ipa -d somePath
cp somePath/archived-expanded-entitlements.xcent somePath/Payload/YourAppName.app
zip -qr somePath/YourAppName.ipa Payload
I find a solution which is working on the archive file of the project which has watch, app and extension.
xcodebuild -exportArchive -archivePath AppName.xcarchive/ -exportPath AppName.ipa -exportFormat ipa -exportWithOriginalSigningIdentity
This command basically uses same signing identify and provisioning profile to export the ipa from raw xcarchive file.
We have sort of work around to generate .ipa that contains iPhone app and apple watch app.
After the .app is generated using Xcodebuild, in the bash script we do the following
A)
Create Directory with Application Name
Inside Application directory create sub directory named Payload
Copy .app into Payload directory
B)
Inside Application directory create sub directory named WatchKitSupport as a sibling to Payload.
Copy a binary named "WK" from the iOS 8.2 SDK in Xcode to your new WatchKitSupport directory. This binary can be found at: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/Library/Application Support/WatchKit/
Make sure the "WK" binary is not touched/re-signed in any way. This is important for validation on device.
Zip the application folder
Rename .zip to .ipa
When expanded the IPA should contain (at least):
xxx.ipa
|________Payload/
|________WatchKitSupport/
|_____WK
This works for us.

Remove codesigning of .app

I developed an iOS app for Cydia, but now I have the Problem, that none except me can run the .deb. I guess because the .app is code-signed. I made a shell script that automatically builds the .deb, I am copying the .app from its path to the debs file structure and then I have to run dpkg-deb -b /Users/David/Downloads/My_App. I already tryed to remove the code-signing with codesign --remove-signature in terminal, but I get unsupported type or version of signature back. Is there a semi-official way to remove the code-signing from an .app in Terminal or in Xcode?
Thanks!

Resources