How to build Ionic 2 apps

On the mac stacks only the Xcode Edge stack has Ionic and Cordova preinstalled (Can I use Bitrise to automatically build (and deploy) Ionic 2 (Cordova) based apps?)

1 Like

Thanks Viktor, but now I`m getting this error:

Building project: /Users/vagrant/git/handup/platforms/ios/handup-ionic.xcworkspace

	Configuration: Debug
	Platform: emulator


Configs:
  project_path: ./platforms/ios/handup.xcodeproj

Analyzing project: ./platforms/ios/handup.xcodeproj

Searching for shared schemes...
  shared scheme count: 0

No shared schemes found, generating default user schemes...
The newly generated schemes, may differs from the ones in your project.
Make sure to share your schemes, to have the expected behaviour.

Failed to recreate project (./platforms/ios/handup.xcodeproj) user schemes, error: output: #<RuntimeError: [Xcodeproj] Unable to open `/Users/vagrant/git/handup/platforms/ios/handup.xcodeproj` because it doesn't exist.>
--- Stack trace: ---
["/usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.4.2/lib/xcodeproj/project.rb:99:in `open'", "/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/bitrise333422609/script.rb:8:in `<main>'"]

exit status 1

@jlcarvalho please include the full input, at least the part after the Git Clone step - I think something’s missing or not configured correctly (e.g. something’s in a subdirectory what wasn’t in our sample).

From the log it seems that your xcode project is generated to the path: REPOROOT/handup/platforms/ios/handup-ionic.xcworkspace

But your config specifies BITRISE_PROJECT_PATH: "./platforms/ios/handup.xcodeproj"

Change ./platforms/ios/handup.xcodeproj to ./platforms/ios/handup-ionic.xcworkspace, to match with the Xcode project (workspace) file generated by ionic.

Now I got this error:

Forcing Development Team: 6DLEBYX6Q8
Forcing Code Signing Identity: iPhone Developer
[09:47:52] $ set -o pipefail && xcodebuild "-workspace" "./platforms/ios/handup-ionic.xcworkspace" "-scheme" "handup" "DEVELOPMENT_TEAM=6DLEBYX6Q8" "CODE_SIGN_IDENTITY=iPhone Developer" "archive" "-archivePath" "/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__archive__969235093/handup.xcarchive" | xcpretty

If you can't find the reason of the error in the log, please check the raw-xcodebuild-output.log
The log file is stored in $BITRISE_DEPLOY_DIR, and its full path
is available in the $BITRISE_XCODE_RAW_RESULT_TEXT_PATH environment variable
Archive failed, error: exit status 65

Did you check the raw-xcodebuild-output.log file? Should be attached to the build (Apps & Artifacts section) by the Deploy to Bitrise.io step

=== BUILD TARGET handup-ionic OF PROJECT handup-ionic WITH CONFIGURATION Release ===

Check dependencies
No profiles for 'com.ionicframework.handupionic731677' were found:  Xcode couldn't find a provisioning profile matching 'com.ionicframework.handupionic731677'.
Code signing is required for product type 'Application' in SDK 'iOS 10.2'

** ARCHIVE FAILED **


The following build commands failed:
	Check dependencies
(1 failure)

http://devcenter.bitrise.io/ios/code-signing/

Run codesigndoc on the generated Xcode project (on your Mac), and then upload all the code signing files it generates to bitrise.io

Of course first you have to make it sure that you actually can Archive the project on your Mac! Open it in Xcode, do an Archive in Xcode, and once the Archive is successful do an IPA export from the organizer (the window auto opened by Xcode after a successful Archive), until you get a signed .ipa of the app

1 Like

Worked! Thanks.

How can I pay you a beer?

1 Like

:joy: no need, just don’t forget to recommend Bitrise to others :wink:

I’ll write a blogpost about Bitrise in portuguese. Thanks again :grinning:

Perfect! :wink:

A post was merged into an existing topic: Xcode + Android SDK combined stack

Another note after debugging a Cordova app with a user: you might want to go with the Xcode 7.3.1 stack in some cases, instead of with the newer Xcode 8.x.x stacks.

In their case once they switched to Xcode 7 the project worked immedately, as the project generated by Ionic/Cordova is compatible with Xcode 7, but not with Xcode 8 out of the box / without any modification (see my comment at Can I use Bitrise to automatically build (and deploy) Ionic 2 (Cordova) based apps? about the default generated Xcode project when using it with Xcode 8).

I followed the guide and it works for me, but I’m getting a development IPA. What if I want a distribution IPA? I try with force_code_sign_identity: iPhone Distribution but it failed.

1 Like

Hi @hcentelles,

Please don’t force any other option, keep it the way it is in the base config.

To set the final code signing type, the one with which the IPA will be signed, use the “export method” (Select method for export) option of the Xcode Archive step to set the final code signing type (e.g. “app-store” or “ad-hoc”), just like you would in case of a native iOS project! Relevant section of the iOS code signing guide: iOS code signing - Bitrise Docs

Apparantly this process is outdated and instead we should use:

http://discuss.bitrise.io/t/generating-release-outputs-for-ionic/2039

how to generate Android app bundle (.abb) in Bitrise using ionic.

Hi @shaileshpendams!

Since this isn’t an option in the Ionic Archive step, you’ll have to run the same Gradle commands you do locally in Android Studio :slight_smile:

1 Like

Thanks for responding…!