47

我会尝试“https://stackoverflow.com/questions/41970435”但我无法获得 .ipa 文件。

谁能解释如何获取 .ipa 文件?

4

3 回答 3

63
  1. 获取.app文件:

     react-native run-ios --configuration=release
    
  2. .app文件路径Build/Products/Release/"<Your_Filename>.app"

  3. 转换.app.ipa

    • 创建文件夹Payload
    • 将文件粘贴.appPayload文件夹中。
    • 压缩Payload文件夹。
    • 更改您想要的名称并将扩展名设置为.ipa.
于 2017-02-09T07:45:27.223 回答
21
  • 从 info.plist 中删除 localhost 项目

    应用程序传输安全设置 -> 异常域

  • 捆绑 ios

    react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
    
  • 在 Xcode 中

    产品->方案->编辑方案->将构建配置更改为RELEASE

  • AppDelegate.m 

    代替

    jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
    

    #ifdef DEBUG
      jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
    #else
      jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
    #endif
    
  • 更改设备 -> 通用 iOS 设备

  • 产品 -> 清洁

  • 产品 -> 构建

  • .app文件可以在

    ~/Library/Developer/Xcode/DerivedData/<app name>/Build/Products/Release-iphoneos/<appname>
    
  • 创建文件夹有效载荷。


  • 将文件粘贴.app到 Payload 文件夹中。


  • 压缩 Payload 文件夹。


  • 更改您想要的名称并将扩展名作为.ipa

于 2018-09-25T12:49:43.543 回答
13

您可以在 ios 目录中运行这些命令。

xcodebuild clean archive -scheme <Scheme> -configuration Release -archivePath ../builds/<App>.xcarchive DEVELOPMENT_TEAM=<DevTeam> PROVISIONING_PROFILE=<PROVISIONING_PROFILE> CODE_SIGN_IDENTITY=<CODE_SIGN_IDENTITY>
xcodebuild -exportArchive -archivePath ../builds/<App>.xcarchive -exportPath ../builds/ -exportOptionsPlist ./iosExportOptions.plist 

和 iosExportOptions.plist 可以是

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>method</key>
  <string>app-store</string>
  <key>teamID</key>
  <string>{TEAM_ID}</string>
</dict>
</plist>

需要注意的是,如果您使用的是 cocoapods,那么您需要使用工作区而不是项目来构建。将此标志添加到第一个命令将确保您以工作区为目标-workspace <AppName>.xcworkspace

您也可以结帐快车道。https://fastlane.tools/

或者

您可以在 Xcode 和 Product -> Archive https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html中填写所有详细信息,例如 DEVELOPMENT_TEAM 等

于 2017-02-08T15:42:11.527 回答