简体   繁体   中英

How to generate an iOS IPA file with Ionic Framework?

I've successfully built the iOS app with the ionic build ios command. But now I want to use TestFlight and it asks me for an IPA file. It seems that file is not generated with that build command. So, how can I generate it?

Thanks

You can easily build IPA from ionic framework. by following these steps

  1. Navigate to app folder

带有 list 命令的 OS X 终端

  1. Run cordova build command

运行 ionic build 命令的 OS X 终端

  1. Open the Xcode Project

带有项目位置的 OS X Finder

  1. Clean the project

XCode 产品 -> 清理菜单

  1. Select iOS mobile device to build for, don't use iOS emulator as device otherwise the archive is disabled.

选择了 Xcode 目标设备

  1. Archive the project

Xcode 项目 -> 存档菜单

  1. Distribute the project

XCode 组织者

  1. Choose a method for distribution

选择分配方法

  1. Choose a Profile

选择个人资料

  1. Select a location to save the .ipa file

将 IPA 文件保存到桌面文件夹

I have generate my .ipa file by using these steps hope it will works for your's.

this article is kind of old but should help you.

In Command line change into the folder that contains your *.xcodeproj, and run the following:

xcodebuild -target "My Target" -scheme "My Scheme"
-configuration Release clean archive

Now you've got your xcarchive , Following line will generate ipa which you can upload to TestFlight.

cd platforms/ios/build/device/usr/bin/xcrun -sdk iphoneos PackageApplication "$(pwd)/$PROJECT_NAME.app" -o "$(pwd)/$PROJECT_NAME.ipa"

Hope this helps

What I do is to run this command:

ionic cordova run ios

It will build and make the project, generate the IPA and then launch the simulator. At that moment I just quit the simulator and voila! I have my IPA with just one command (Ionic 4).

Use npx ionic build ios --device to build the IPA for debugging and adhoc installations

Use npx ionic build ios --device --release to build for release.

You need to have a build.json file to specify your keys. Note the CLANG is to prevent compilation errors from the CocoaPods which they made into an error rather than a warning from before.

{
  "ios": {
    "debug": {
      "buildFlag": [
        "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES"
      ],
      "developmentTeam": "XXXXXX",
      "automaticProvisioning": true,
      "packageType": "development"
    },
    "release": {
      "buildFlag": [
        "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES"
      ],
      "codeSignIdentity": "Apple Development",
      "developmentTeam": "XXXXXX",
      "automaticProvisioning": true,
      "packageType": "app-store"
    }
  }
}

Before it will upload to AppStore/TestFlight you need to modify the platform/ios/exportOptions.plist file to include

<key>destination</key>
<string>upload</string>

Then deploy it to the AppStore as follows

xcodebuild -exportArchive -archivePath "platforms/ios/myApp.xcarchive" \
  -allowProvisioningUpdates \
  -exportOptionsPlist platforms/ios/exportOptions.plist \
  -exportPath platforms/ios/build/device

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM