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