For example
Because the test environment often needs to be modified, packaged, tested, modified, etc., if xcode's native packaging method is time-consuming, or automatic integration tools such as Fastlane and Jenkins are used, but the early configuration is cumbersome and laborious, and the later problems are not easy to solve. Therefore, the following content is available:
Objective: to modify a parameter to realize automatic package and upload in one step
Start:
NO.1 add script phase
`
`
NO.2 add to get your python running address (usually / usr/bin/python)
Indefinitely, the terminal can run the command: where is Python get
NO.3 copy the following code into the file
#!/usr/bin/python # -*- coding: utf-8 -*- import os import requests import webbrowser import subprocess import shutil # if need update package please set 1 updatePackage = 0 appFileFullPath = '/Users/Cube/Library/Developer/Xcode/DerivedData/TaoMei-cgateidmhzznixahnazxrlluggia/Build/Products/Debug-iphoneos/TaoMei.app' PayLoadPath = '/Users/Cube/Desktop/Payload' packBagPath = '/Users/Cube/Desktop/ProgramBag' openUrlPath = 'https://www.pgyer.com/manager/dashboard/app/55a92912ff9d474b9bf9358a25047041' USER_KEY = "14da2a85e3407edcfbe59c4f042f2987" API_KEY = "2cb66731e946cc0ef507542f3ee42edc" def uploadIPA(IPAPath): if(IPAPath==''): print("\n*************** NONE IPA*********************\n") return else: print("\n***************BEGIN UPLOAD *********************\n") url='http://www.pgyer.com/apiv1/app/upload' data={ 'uKey':USER_KEY, '_api_key':API_KEY, 'installType':'2', 'password':'', 'updateDescription':"" } files={'file':open(IPAPath,'rb')} r=requests.post(url,data=data,files=files) def openDownloadUrl(): os.chdir('/Users/Cube/Desktop') subprocess.call(["rm","-rf",packBagPath]) webbrowser.open(openUrlPath,new=1,autoraise=True) print ("\n*************** SUCCESS *********************\n") def bulidIPA(): subprocess.call(["rm","-rf",packBagPath]) mkdir(PayLoadPath) subprocess.call(["cp","-r",appFileFullPath,PayLoadPath]) subprocess.call(["mkdir","-p",packBagPath]) subprocess.call(["cp","-r",PayLoadPath,packBagPath]) subprocess.call(["rm","-rf",PayLoadPath]) os.chdir(packBagPath) subprocess.call(["zip","-r","./Payload.zip","."]) print ("\n*************** PACK DONE *********************\n") subprocess.call(["mv","payload.zip","Payload.ipa"]) subprocess.call(["rm","-rf","./Payload"]) def mkdir(PayLoadPath): isExists = os.path.exists(PayLoadPath) if not isExists: os.makedirs(PayLoadPath) print(PayLoadPath + 'BUILD DONE') return True else: print (PayLoadPath + 'BUILD FALSE') return False if __name__ == '__main__': if updatePackage: bulidIPA() uploadIPA('%s/Payload.ipa'%packBagPath) openDownloadUrl() else: print ("\n*************** NO PACKAGE *********************\n")
Note here that the copy format, python syntax is extremely strict with indent alignment
NO.4 go to dandelion homepage to create your APP, get the corresponding key, and modify the parameters in the project
end
When you need to package, you can modify the updatePackage parameter to 1, connect to the real machine for compilation, and automatically upload to the dandelion homepage and open your browser for refresh