1. 文章底部有資源包可下載 資源來自一名叫董玉毛同學的分享,但是地址忘了,sorry,如有侵權,請聯系我,謝謝!!!
2.修改配置文件ProjectConfig
(1) 項目路徑 項目名稱
(2) 輸出包路徑
(3) 蒲公英appkey ukey
3.看代碼(ps,其實就是把終端命令弄到了xcode中集中執行)
// 刪除項目之前build的文件夾
[XBProjectPath deleteDerivedDataSubFolder];
//切到項目目錄
NSString *cd = [NSString stringWithFormat:@"cd %@",XB_ProjectPath];
// 1.清理工程
NSString *clean = [NSString stringWithFormat:@"/usr/bin/xcodebuild -workspace %@.xcworkspace -scheme %@ clean",XB_ProjectName,XB_ProjectName];
// 2.編譯項目
NSString *build = [NSString stringWithFormat:@"/usr/bin/xcodebuild -workspace %@.xcworkspace -scheme %@ -sdk iphoneos -configuration %@ build" ,XB_ProjectName,XB_ProjectName,buildType];
NSString *shell1 = [NSString stringWithFormat:@"%@\n %@\n %@\n",cd,clean,build];
system([shell1 cStringUsingEncoding:NSUTF8StringEncoding]);
// 3.輸出包
NSString *run = [NSString stringWithFormat:@"/usr/bin/xcrun -sdk iphoneos PackageApplication -v %@",[[XBProjectPath sharePProjectPath] projectXcodeBuildPath:buildType]];
// 4.上傳到蒲公英
NSString *upload = [NSString stringWithFormat:@"curl -F file=@%@ -F uKey=%@ -F _api_key=%@ https://qiniu-storage.pgyer.com/apiv1/app/upload",[NSString stringWithFormat:@"%@/%@.ipa",XB_IPAPath,XB_ProjectName],XB_PgyerUserKey,XB_PgyerAPIKey];
// 5.運行
NSString *shell = [NSString stringWithFormat:@" %@\n %@\n",run,upload];
system([shell cStringUsingEncoding:NSUTF8StringEncoding]);
然后command + R 就可以等待了,成功后蒲公英會發送郵件到您的郵箱。
資源包下載請加Q群: 582658095