React Native iOS应用程序无法在fastlane中构建,但可以在Xcode中工作

ogsagwnx  于 2023-06-24  发布在  React
关注(0)|答案(2)|浏览(134)

我正在构建一个React Native应用程序,并使用Fastlane来管理我的签名,构建和部署。我试图构建一个ad-hoc包,但每次我使用Fastlane gym运行构建时,我都会收到一条关于丢失头文件的错误消息。构建在Product -> Build的Xcode中运行良好,我可以在本地模拟器中运行应用程序。
我看到的错误消息来自gymAppDelegate.m:13:9: 'ReactNativeNavigation/ReactNativeNavigation.h' file not found,我知道它与React Native Navigation设置相关,并按照步骤修复它。
以前有没有人见过这个错误,或者对如何获得更多关于Xcode构建工作的信息有任何建议?我试过清理我的buildpodsnode_modules目录,但没有成功。React Native 0.59.9和Xcode 11.3.1
下面是我的Fastfile

match(
  type: "adhoc",
  git_branch: "master",
  git_url: "<my cert repo>",
  app_identifier: ["<main app ID>", "<app extension ID"],
  team_id: "<my team ID>",
  readonly: true,
)
sh('yarn', 'build:ios')
gym(
  workspace: "myApp.xcworkspace",
  scheme: "myApp",
  configuration: "Beta",
  export_method: 'ad-hoc',
  output_directory: "builds",
  output_name: ipaName,
)

仅供参考,本例中yarn build:iosreact-native bundle --dev false --entry-file index.js --bundle-output ios/main.jsbundle --assets-dest ios --platform ios的别名

py49o6xq

py49o6xq1#

你不必调用yarn build:ios。健身房会处理的

u3r8eeie

u3r8eeie2#

Azure DevOps CICD设置;这是完整解决方案

注意:ENV ['variable']是在Azure DevOps管道上配置的变量
1.添加到Apple

app_identifier("app.bundle.name") # The bundle identifier of your app

1.将代码放入Gymfile

scheme("ProjectSchemeName")
 export_options({
                method: "app-store",
                provisioningProfiles: { 
                "app.bundle.name" =>  "Distribution-ProvisioningProfileName",
                   }
               })

  # Specify the path to store .ipa file
  output_directory("./fastlane/builds")
  # Excludes bitcode from the build
  include_bitcode(false)
  # Excludes symbols from the build.
  include_symbols(false)

1.添加到交付文件

# Indicates that it’s a free app.
price_tier(0)
# Answer the questions Apple would present to you upon manually submitting for review
submission_information({
       export_compliance_compliance_required: false,
       export_compliance_encryption_updated: false,
       export_compliance_uses_encryption: false,
       content_rights_contains_third_party_content: false,
       add_id_info_uses_idfa: false,
       export_compliance_contains_third_party_cryptography: false,
       export_compliance_contains_proprietary_cryptography: false,
       content_rights_contains_third_party_content: false
     })

# Contact information for the app review team.
app_review_information(
       first_name: "Name",
       last_name: "Name",
       phone_number: "4324234324",
       email_address: "example@gmail.com",
       demo_user: "test@app.com",
       demo_password: "Password",
       notes: "This mobile application requires subscription."
 )

 automatic_release(false)

 reset_ratings(false)

 app_rating_config_path("./fastlane/metadata/app_store_rating_config.json")

 copyright("© 2022 organisation")

 primary_category("Business")

1.将Fastfile更新为

default_platform(:ios)

 platform :ios do

 desc "Description of what the lane does"
 lane :authenticate_app_stoe do

  #  APP STORE AUTHENTICATION USING API KEY
 app_store_connect_api_key(
      key_id: ENV['KEY_ID'],
      issuer_id: ENV['ISSUER_ID'],
      key_content: ENV['KEY_CONTENT'],
      is_key_content_base64: true,
      in_house: false
     )
 end

 # FASTLANE SYNC TO USE CERTIFICATES ON LOCAL MACHINE RATHER THAN CREATING NEW ONE.  
 desc "Sync certificates"
 lane :sync_certificates do
     #read-only disables match from overriding the existing certificates.
     match({readonly: true, type: "appstore"})
 end

 lane :set_build_number do 
      authenticate_app_store
      increment_version_number(version_number: ENV['APP_VERSION'])
      increment_build_number({ build_number: latest_testflight_build_number(version: ENV['APP_VERSION'], app_identifier: 'app.bundle.name') + 1 }) 
 end

 lane :deliver_metadata do
      authenticate_app_store
      deliver(
              skip_binary_upload: true,
              username: ENV['USERNAME'], #'example@gmail.com',
              precheck_include_in_app_purchases: false,
              automatic_release: false,
              skip_app_version_update: false,
              skip_screenshots: true,
              force: true
            )
 end

 # LANE TO UPLOAD BUILD ON TESTFLIGHT
 desc "Create ipa"
 lane :beta_release do
      build
      upload_to_testflight()
 end

 desc "Create ipa"
 lane :build do
      set_build_number
      build_app
 end

 # LATE FOR BETA BUILD DEPLOYMENT
 desc "Create ipa"
 lane :release do
      build
      deliver_metadata
 end

 end
  1. app_store_rating_config.json示例
{
 "CARTOON_FANTASY_VIOLENCE": 0,
 "REALISTIC_VIOLENCE": 0,
 "PROLONGED_GRAPHIC_SADISTIC_REALISTIC_VIOLENCE": 0,
 "PROFANITY_CRUDE_HUMOR": 0,
 "MATURE_SUGGESTIVE": 0,
 "HORROR": 0,
 "MEDICAL_TREATMENT_INFO": 0,
 "ALCOHOL_TOBACCO_DRUGS": 0,
 "GAMBLING": 0,
 "SEXUAL_CONTENT_NUDITY": 0,
 "GRAPHIC_SEXUAL_CONTENT_NUDITY": 0,
 "UNRESTRICTED_WEB_ACCESS": 0,
 "GAMBLING_CONTESTS": 0
}

相关问题