Application Upload Mode

1. The Apple method

  1. Upload ipA directly through Xcode
  2. Use the Application Loader provided with Xcode (the latest version of Xcode does not support this method)
  3. Upload ipA using altool.
  4. Upload ipA through the Transporter application. Apple’s new app
2. Other methods
  1. Shell script packaging
  2. Fastlane fast packing
  3. Jenkins visual packaging

Fastlane packaging

The official documentation

Reference documentation

The installation

Like Fastlane, Cocoapods is a Collection of Ruby-based development scripts, so it looks similar

  1. First, install the correct Ruby version and verify with the command line on the terminal
ruby -v
Copy the code
  1. Check whether the Xcode command line tool is installed
xcode-select --install

Copy the code
  1. Once the above dependencies are configured, they can be installed via Rubygem
sudo gem install fastlane

Copy the code
  1. After successful installation, CD to your project directory and execute

fastlane init

Copy the code
Introduction to Basic Files

After initialization, there are two important files in the./fastlane file

1. Appfile

Store the AppleID or BundleID and other fastlane information. Basically we don’t need to change the contents of this file.

The default generated file content:

app_identifier("[[APP_IDENTIFIER]]")  # The bundle identifier of your app
apple_id("[[APPLE_ID]]")              # Your Apple email address

Copy the code
2. FastFile

The default generated file content:

# This file contains the fastlane.tools configuration # You can find the documentation at https://docs.fastlane.tools # # For a list of all available actions, check out # # https://docs.fastlane.tools/actions # # For a list of all available plugins, Check out # # # # https://docs.fastlane.tools/plugins/available-plugins if you want to fastlane updated automatically cancel one line below the comment # Uncomment the line if you want fastlane to automatically update itself update_fastlaneCopy the code
default_platform(:ios) platform :ios do #1. Before_all do end #2. Desc "Runs all the tests" lane :test do scan end #3. Used to perform the task after the operation of the after_all do | | lane end # 4. For the operational error error do | lane, exception | # slack (# message: "error message" #) end to endCopy the code
3. Fastlane
Lane :beta do // Define the task named beta // build App build_app(workspace: "Expample. xcworkspace", Scheme: "example") // Upload to testFilght upload_to_testflight endCopy the code

Two of the actions

  • Build_app generates ipA files
  • Upload_to_testflight Upload_IPA file to TestFilght

Execute from the console

fastlane beta 
Copy the code

The ipA will be generated and uploaded to TestFilght.

practice

Write your own Lane

Desc "Post to Fir" lane :pulish_to_fir do Output_directory: './firim', scheme: 'XXXX ', silent: False # Hide unnecessary building information configuration: 'Debug', # specify packaging mode, Release or Debug export_xcargs: "-allowprovisioningUpdates ", # access keystring export_options: {# export list of options or hash path with export options method: 'development', provisioningProfiles : { "xxx.xxx.xxx" : Firim_api_token firim(firiM_API_token: firim_API_token: firiM_API_token: Notification (title: "Published successfully!") ", message: "Successfully uploaded to pugongying platform, please contact the tester to start testing! ?" , open: "https://www.pgyer.com") endCopy the code
CurrentTime = time.new. strfTime ("%Y-%m-%d-%H-% m- ") build_app(export_method: "Ad-hoc ", # method for exporting the archive workspace:" ewDemo.xcworkspace ", # workspace file path scheme: "EWDemo", # ensure that its scheme is marked with Shared include_symbols: false, # ipa contains the symbol output_directory: Output_name: "#{currentTime}#{'EWDemo. Ipa '}", system "open.. /fastlane/buildCopy the code
Break down

cocoapods : Runs pod install for the project

Gym: Alias for the build_app build_iOS_APP Action Alias, which itself is the package of the XcodeBuild tool

Pay attention to
App-store, #AppStore Official production environment pack ad-hoc, # production beta pack enterprise, # enterprise beta pack ($299) development beta packCopy the code

Fastlane packs dandelions

  1. Install the Fastlane plugin for Dandelion
fastlane add_plugin pgyer
Copy the code
  1. Go to the project directory and initialize Fastlane
fastlane init

Copy the code
  1. Modify the FastFile file
lane :beta do
  build_app(export_method: "ad-hoc")
  pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141", user_key: "4a5bcxxxxxxxxxxxxxxx3a9e")
end
Copy the code

or

lane :beta do
  build_app(export_method: "ad-hoc")
  
  api_key = "aaaaaaa"
  user_key = "bbbbbb"
  
  pgyer(api_key:"#{api_key}",user_key:"#{user_key}")
 
 end
Copy the code

In Xcode 8.3 and later versions, the value of export_method needs to be set according to the developer’s packaging type. Optional values include App-Store, ad-hoc, development, and Enterprise.

  1. Run the fastlane command
fastlane beta

Copy the code

Fastlane package upload Firim

  1. Install Firim’s Fastlane plugin
fastlane add_plugin firim
Copy the code

and

gem install fir-cli
Copy the code
  1. Add uploads to Fastfile
Puts "* * * * * * * * * * * * * * * * | started uploading firim | * * * * * * * * * * * * * * * *" firim (firim_api_token: "1 ea0d * * * * * * * * 0083740 a1 f741 3 b * * * *") puts "* * * * * * * * * * * * * * * * | started uploading firim | * * * * * * * * * * * * * * * *"Copy the code

Matters needing attention

You can use Fastlane Actions [firim] to check if the action is installed properly, and it also displays all the current plug-ins