Commit 545346b4239fa885ee391280641efa3dd9a7a8b9
1 parent
af3db83b
no message
Showing
7 changed files
with
265 additions
and
16 deletions
CNLiveScioLive.xcodeproj/project.pbxproj
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | archiveVersion = 1; |
| 4 | 4 | classes = { |
| 5 | 5 | }; |
| 6 | - objectVersion = 50; | |
| 6 | + objectVersion = 51; | |
| 7 | 7 | objects = { |
| 8 | 8 | |
| 9 | 9 | /* Begin PBXBuildFile section */ |
| ... | ... | @@ -3608,8 +3608,8 @@ |
| 3608 | 3608 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 3609 | 3609 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; |
| 3610 | 3610 | CODE_SIGN_ENTITLEMENTS = CNLiveScioLive/CNLiveScioLive.entitlements; |
| 3611 | - CODE_SIGN_IDENTITY = "Apple Development"; | |
| 3612 | - CODE_SIGN_STYLE = Automatic; | |
| 3611 | + CODE_SIGN_IDENTITY = "iPhone Distribution"; | |
| 3612 | + CODE_SIGN_STYLE = Manual; | |
| 3613 | 3613 | CURRENT_PROJECT_VERSION = 366; |
| 3614 | 3614 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 3615 | 3615 | ENABLE_BITCODE = NO; |
| ... | ... | @@ -3645,10 +3645,10 @@ |
| 3645 | 3645 | "$(PROJECT_DIR)/CNLiveScioLive/Pages/SDK/ShareSDK/ShareSDK/Support/PlatformSDK/SinaWeiboSDK", |
| 3646 | 3646 | "$(PROJECT_DIR)/CNLiveScioLive/Pages/SDK/ShareSDK/ShareSDK/Support/PlatformSDK/WeChatSDK", |
| 3647 | 3647 | ); |
| 3648 | - MARKETING_VERSION = 3.5.5; | |
| 3648 | + MARKETING_VERSION = 3.5.6; | |
| 3649 | 3649 | PRODUCT_BUNDLE_IDENTIFIER = cn.gov.scio.live1; |
| 3650 | 3650 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 3651 | - PROVISIONING_PROFILE_SPECIFIER = ""; | |
| 3651 | + PROVISIONING_PROFILE_SPECIFIER = SCIOLive_distribution; | |
| 3652 | 3652 | TARGETED_DEVICE_FAMILY = 1; |
| 3653 | 3653 | }; |
| 3654 | 3654 | name = Debug; |
| ... | ... | @@ -3660,8 +3660,8 @@ |
| 3660 | 3660 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 3661 | 3661 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; |
| 3662 | 3662 | CODE_SIGN_ENTITLEMENTS = CNLiveScioLive/CNLiveScioLive.entitlements; |
| 3663 | - CODE_SIGN_IDENTITY = "Apple Development"; | |
| 3664 | - CODE_SIGN_STYLE = Automatic; | |
| 3663 | + CODE_SIGN_IDENTITY = "iPhone Distribution"; | |
| 3664 | + CODE_SIGN_STYLE = Manual; | |
| 3665 | 3665 | CURRENT_PROJECT_VERSION = 366; |
| 3666 | 3666 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 3667 | 3667 | ENABLE_BITCODE = NO; |
| ... | ... | @@ -3697,10 +3697,10 @@ |
| 3697 | 3697 | "$(PROJECT_DIR)/CNLiveScioLive/Pages/SDK/ShareSDK/ShareSDK/Support/PlatformSDK/SinaWeiboSDK", |
| 3698 | 3698 | "$(PROJECT_DIR)/CNLiveScioLive/Pages/SDK/ShareSDK/ShareSDK/Support/PlatformSDK/WeChatSDK", |
| 3699 | 3699 | ); |
| 3700 | - MARKETING_VERSION = 3.5.5; | |
| 3700 | + MARKETING_VERSION = 3.5.6; | |
| 3701 | 3701 | PRODUCT_BUNDLE_IDENTIFIER = cn.gov.scio.live1; |
| 3702 | 3702 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 3703 | - PROVISIONING_PROFILE_SPECIFIER = ""; | |
| 3703 | + PROVISIONING_PROFILE_SPECIFIER = SCIOLive_distribution; | |
| 3704 | 3704 | TARGETED_DEVICE_FAMILY = 1; |
| 3705 | 3705 | }; |
| 3706 | 3706 | name = Release; | ... | ... |
CNLiveScioLive/AppDelegate.m
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | [[UITabBar appearance] setTranslucent:NO]; |
| 30 | 30 | |
| 31 | 31 | #pragma mark - 打包注意 |
| 32 | -// [AvoidCrash makeAllEffective]; | |
| 32 | + [AvoidCrash makeAllEffective]; | |
| 33 | 33 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
| 34 | 34 | self.window.backgroundColor = [UIColor whiteColor]; |
| 35 | 35 | ... | ... |
CNLiveScioLive/Info.plist
| ... | ... | @@ -2,8 +2,6 @@ |
| 2 | 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 3 | 3 | <plist version="1.0"> |
| 4 | 4 | <dict> |
| 5 | - <key>UIUserInterfaceStyle</key> | |
| 6 | - <string>Light</string> | |
| 7 | 5 | <key>CFBundleDevelopmentRegion</key> |
| 8 | 6 | <string>en</string> |
| 9 | 7 | <key>CFBundleDisplayName</key> |
| ... | ... | @@ -121,5 +119,7 @@ |
| 121 | 119 | <string>UIInterfaceOrientationLandscapeLeft</string> |
| 122 | 120 | <string>UIInterfaceOrientationLandscapeRight</string> |
| 123 | 121 | </array> |
| 122 | + <key>UIUserInterfaceStyle</key> | |
| 123 | + <string>Light</string> | |
| 124 | 124 | </dict> |
| 125 | 125 | </plist> | ... | ... |
CNLiveScioLive/Pages/Login/Controller/CNLiveLoginViewController.m
| ... | ... | @@ -301,8 +301,6 @@ |
| 301 | 301 | |
| 302 | 302 | } else { |
| 303 | 303 | [AlertViewTool showHUDViewText:CustomStr(@"LoginFailure")]; |
| 304 | - | |
| 305 | - | |
| 306 | 304 | } |
| 307 | 305 | } failure:^(NSDictionary *errorDic) { |
| 308 | 306 | [AlertViewTool showHUDViewText:errorDic[@"errorMessage"]]; |
| ... | ... | @@ -466,8 +464,7 @@ |
| 466 | 464 | return self.view.window; |
| 467 | 465 | } |
| 468 | 466 | |
| 469 | -- (void)networkParamAction | |
| 470 | -{ | |
| 467 | +- (void)networkParamAction { | |
| 471 | 468 | NSMutableDictionary * mDict = [[NSMutableDictionary alloc] init]; |
| 472 | 469 | [mDict setValue:@"" forKey:@"loginSid"]; |
| 473 | 470 | [mDict setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"] forKey:@"platform_id"]; |
| ... | ... | @@ -483,4 +480,5 @@ |
| 483 | 480 | [CNLiveNetworking setResponseSerializerType:CNLiveResponseSerializerJSON]; |
| 484 | 481 | |
| 485 | 482 | } |
| 483 | + | |
| 486 | 484 | @end | ... | ... |
auto_upload.py
0 → 100755
| 1 | +#!/usr/bin/env python3 | |
| 2 | +# -*- coding: utf-8 -*- | |
| 3 | + | |
| 4 | +import os | |
| 5 | +import requests | |
| 6 | +import webbrowser | |
| 7 | +import subprocess | |
| 8 | +import time | |
| 9 | +import smtplib | |
| 10 | +import argparse | |
| 11 | + | |
| 12 | +from email.mime.text import MIMEText | |
| 13 | +from email import encoders | |
| 14 | +from email.header import Header | |
| 15 | +from email.utils import parseaddr, formataddr | |
| 16 | +from collections import ChainMap | |
| 17 | + | |
| 18 | +project_name = 'CNLiveScioLive' # 项目名称 | |
| 19 | +upload_version = '1.0.0' # 项目版本 | |
| 20 | +archive_workspace_path = '/Users/cnlive-zxw/Desktop/ScioLive' # 项目路径 | |
| 21 | +export_directory = 'Products' # 输出的文件夹 | |
| 22 | +ipa_download_url = 'https://www.pgyer.com/QgmN' #蒲公英的APP地址 | |
| 23 | + | |
| 24 | +# 苹果账号API_KEY、API_ISSUER | |
| 25 | +APPLE_API_KEY = 'SVDD8X9884' | |
| 26 | +APPLE_API_ISSUER = '69a6de70-6693-47e3-e053-5b8c7c11a4d1' | |
| 27 | + | |
| 28 | +# 蒲公英账号USER_KEY、API_KEY | |
| 29 | +PGYER_USER_KEY = '6a9a62d9659d6821721cf34169358ddc' | |
| 30 | +PGYER_API_KEY = '102d5b282e595feb713f24ecf1763313' | |
| 31 | + | |
| 32 | +# 发送邮件 | |
| 33 | +from_address = '153993236@qq.com' # 发送人的地址 | |
| 34 | +password = 'hqotqsilkkylcbac' # 邮箱密码换成他提供的16位授权码 | |
| 35 | +to_address = '153993236@qq.com' # 收件人地址,可以是多个的 | |
| 36 | +smtp_server = 'smtp.qq.com' # 因为我是使用QQ邮箱 | |
| 37 | + | |
| 38 | +# 1.自动打包并上传到AppStore | |
| 39 | +# 2.自动打包并上传到蒲公英,发邮件通知 | |
| 40 | + | |
| 41 | +class AutoUpload(object): | |
| 42 | + def __init__(self, number): | |
| 43 | + self.number = number | |
| 44 | + | |
| 45 | + def clean(self): | |
| 46 | + print("\n\n===========开始Clean操作===========") | |
| 47 | + start = time.time() | |
| 48 | + clean_command = 'xcodebuild clean -workspace %s/%s.xcworkspace -scheme %s -configuration Release' % ( | |
| 49 | + archive_workspace_path, project_name, project_name) | |
| 50 | + clean_command_run = subprocess.Popen(clean_command, shell=True) | |
| 51 | + clean_command_run.wait() | |
| 52 | + end = time.time() | |
| 53 | + | |
| 54 | + clean_result_code = clean_command_run.returncode | |
| 55 | + if clean_result_code != 0: | |
| 56 | + print("=======Clean失败,用时:%.2f秒=======" % (end - start)) | |
| 57 | + else: | |
| 58 | + print("=======Clean成功,用时:%.2f秒=======" % (end - start)) | |
| 59 | + self.archive() | |
| 60 | + | |
| 61 | + def archive(self): | |
| 62 | + print("\n\n===========开始Archive操作===========") | |
| 63 | + # 删除之前的文件 | |
| 64 | + subprocess.call(['rm', '-rf', '%s/%s' % (archive_workspace_path, export_directory)]) | |
| 65 | + time.sleep(1) | |
| 66 | + # 创建文件夹存放打包文件 | |
| 67 | + subprocess.call(['mkdir', '-p', '%s/%s' % (archive_workspace_path, export_directory)]) | |
| 68 | + time.sleep(1) | |
| 69 | + | |
| 70 | + start = time.time() | |
| 71 | + archive_command = 'xcodebuild archive -workspace %s/%s.xcworkspace -scheme %s -configuration Release -archivePath %s/%s/%s.xcarchive' % ( | |
| 72 | + archive_workspace_path, project_name, project_name, archive_workspace_path, export_directory, project_name) | |
| 73 | + archive_command_run = subprocess.Popen(archive_command, shell=True) | |
| 74 | + archive_command_run.wait() | |
| 75 | + end = time.time() | |
| 76 | + | |
| 77 | + archive_result_code = archive_command_run.returncode | |
| 78 | + if archive_result_code != 0: | |
| 79 | + print("=======Archive失败,用时:%.2f秒=======" % (end - start)) | |
| 80 | + else: | |
| 81 | + print("=======Archive成功,用时:%.2f秒=======" % (end - start)) | |
| 82 | + self.export() | |
| 83 | + | |
| 84 | + def export(self): | |
| 85 | + print("\n\n===========开始Export操作===========") | |
| 86 | + print("\n\n==========请你耐心等待一会~===========") | |
| 87 | + start = time.time() | |
| 88 | + | |
| 89 | + plist_name = 'exportAppstore' | |
| 90 | + if self.number == 1: | |
| 91 | + plist_name = 'exportAppstore' | |
| 92 | + | |
| 93 | + elif self.number == 2: | |
| 94 | + plist_name = 'exportTest' | |
| 95 | + | |
| 96 | + export_command = 'xcodebuild -exportArchive -archivePath %s/%s/%s.xcarchive -exportPath %s/%s -exportOptionsPlist %s/%s.plist' % ( | |
| 97 | + archive_workspace_path, export_directory, project_name, archive_workspace_path, export_directory, archive_workspace_path, plist_name) | |
| 98 | + export_command_run = subprocess.Popen(export_command, shell=True) | |
| 99 | + export_command_run.wait() | |
| 100 | + end = time.time() | |
| 101 | + | |
| 102 | + export_result_code = export_command_run.returncode | |
| 103 | + if export_result_code != 0: | |
| 104 | + print("=======导出IPA失败,用时:%.2f秒=======" % (end - start)) | |
| 105 | + else: | |
| 106 | + print("=======导出IPA成功,用时:%.2f秒=======" % (end - start)) | |
| 107 | + # 删除archive.xcarchive文件 | |
| 108 | + # subprocess.call(['rm', '-rf', '%s/%s/%s.xcarchive' % (archive_workspace_path, export_directory, project_name)]) | |
| 109 | + self.upload('%s/%s/%s.ipa' % (archive_workspace_path, export_directory, project_name)) | |
| 110 | + | |
| 111 | + def upload(self, ipa_path): | |
| 112 | + if ipa_path: | |
| 113 | + if self.number == 1: | |
| 114 | + print("\n\n===========开始上传AppStore操作===========") | |
| 115 | + start = time.time() | |
| 116 | + export_command = 'xcrun altool --upload-app -f %s -t ios --apiKey %s --apiIssuer %s --verbose' % ( | |
| 117 | + ipa_path, APPLE_API_KEY, APPLE_API_ISSUER) | |
| 118 | + export_command_run = subprocess.Popen(export_command, shell=True) | |
| 119 | + export_command_run.wait() | |
| 120 | + end = time.time() | |
| 121 | + | |
| 122 | + export_result_code = export_command_run.returncode | |
| 123 | + if export_result_code != 0: | |
| 124 | + print("=======上传AppStore失败,用时:%.2f秒=======" % (end - start)) | |
| 125 | + else: | |
| 126 | + print("=======上传AppStore成功,用时:%.2f秒=======" % (end - start)) | |
| 127 | + elif self.number == 2: | |
| 128 | + print("\n\n===========开始上传蒲公英操作===========") | |
| 129 | + start = time.time() | |
| 130 | + # https://www.pgyer.com/doc/api 查看具体参数 | |
| 131 | + url = 'http://www.pgyer.com/apiv1/app/upload' | |
| 132 | + data = { | |
| 133 | + 'uKey': PGYER_USER_KEY, | |
| 134 | + '_api_key': PGYER_API_KEY, | |
| 135 | + 'installType': '1', | |
| 136 | + 'updateDescription': upload_version | |
| 137 | + } | |
| 138 | + files = {'file': open(ipa_path, 'rb')} | |
| 139 | + r = requests.post(url, data=data, files=files) | |
| 140 | + end = time.time() | |
| 141 | + if r.status_code == 200: | |
| 142 | + print("=======上传蒲公英成功,用时:%.2f秒=======" % (end - start)) | |
| 143 | + # 是否需要打开浏览器 | |
| 144 | + self.open_browser(self) | |
| 145 | + self.send_email() | |
| 146 | + else: | |
| 147 | + print("=======上传蒲公英失败,用时:%.2f秒=======" % (end - start)) | |
| 148 | + | |
| 149 | + else: | |
| 150 | + print("\n\n===========没有找到对应的ipa===========") | |
| 151 | + | |
| 152 | + return | |
| 153 | + | |
| 154 | + @staticmethod | |
| 155 | + def open_browser(self): | |
| 156 | + webbrowser.open(ipa_download_url, new=1, autoraise=True) | |
| 157 | + | |
| 158 | + @staticmethod | |
| 159 | + def _format_address(self, s): | |
| 160 | + name, address = parseaddr(s) | |
| 161 | + return formataddr((Header(name, 'utf-8').encode(), address)) | |
| 162 | + | |
| 163 | + def send_email(self): | |
| 164 | + msg = MIMEText('<html><body><h1>Hello</h1>' + | |
| 165 | + '<p>╮(╯_╰)╭<a href=\"'+ipa_download_url+'\" rel="external nofollow" >应用已更新,请下载测试</a>╮(╯_╰)╭</p>' + | |
| 166 | + '<p>蒲公英的更新会有延迟,具体版本时间以邮件时间为准</p>' + | |
| 167 | + '</body></html>', 'html', 'utf-8') | |
| 168 | + msg['From'] = self._format_address(self, 'iOS开发团队 <%s>' % from_address) | |
| 169 | + msg['Subject'] = Header('来自iOS开发团队的问候……', 'utf-8').encode() | |
| 170 | + server = smtplib.SMTP(smtp_server, 25) # SMTP协议默认端口是25 | |
| 171 | + server.set_debuglevel(1) | |
| 172 | + server.login(from_address, password) | |
| 173 | + server.sendmail(from_address, [to_address], msg.as_string()) | |
| 174 | + server.quit() | |
| 175 | + print("\n\n===========邮件发送成功===========") | |
| 176 | + | |
| 177 | +# 获取命令行的参数 | |
| 178 | +def command_line(): | |
| 179 | + # 构造缺省参数: | |
| 180 | + defaults = { | |
| 181 | + 'store': 'app-store' | |
| 182 | + } | |
| 183 | + | |
| 184 | + # 构造命令行参数: | |
| 185 | + parser = argparse.ArgumentParser() | |
| 186 | + parser.add_argument('-s', '--store') | |
| 187 | + namespace = parser.parse_args() | |
| 188 | + command_line_args = { k: v for k, v in vars(namespace).items() if v } | |
| 189 | + | |
| 190 | + # 组合成ChainMap: | |
| 191 | + combined = ChainMap(command_line_args, os.environ, defaults) | |
| 192 | + | |
| 193 | + # 获取参数 | |
| 194 | + if combined['store'] == 'app-store': | |
| 195 | + return 1 | |
| 196 | + elif combined['store'] == 'pgyer': | |
| 197 | + return 2 | |
| 198 | + else: | |
| 199 | + return 0 | |
| 200 | + | |
| 201 | +# 程序入口 | |
| 202 | +if __name__ == '__main__': | |
| 203 | + | |
| 204 | + # 1、先用命令行方式,获取number | |
| 205 | + # python3 upload.py -s app-store 或者 python3 upload.py -store app-store | |
| 206 | + # python3 upload.py -s pgyer 或者 python3 upload.py -store pgyer | |
| 207 | + number = command_line() | |
| 208 | + if (number != 1 and number != 2): | |
| 209 | + | |
| 210 | + # 2、再用手动输入方式,获取number | |
| 211 | + number = int(input("\n\nPlace enter the number you want to upload ? [ 1:app-store 2:蒲公英 ] ")) | |
| 212 | + while (number != 1 and number != 2): | |
| 213 | + print("Error! Should enter 1 or 2") | |
| 214 | + number = int(input("\n\nPlace enter the number you want to upload ? [ 1:app-store 2:蒲公英 ] ")) | |
| 215 | + | |
| 216 | + # 3、根据number创建上传对象 | |
| 217 | + upload = AutoUpload(number) | |
| 218 | + upload.clean() | |
| 219 | + | ... | ... |
exportAppstore.plist
0 → 100755
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| 3 | +<plist version="1.0"> | |
| 4 | +<dict> | |
| 5 | + <key>provisioningProfiles</key> | |
| 6 | + <dict> | |
| 7 | + <key>cn.gov.scio.live1</key> | |
| 8 | + <string>SCIOLive_distribution</string> | |
| 9 | + </dict> | |
| 10 | + <key>method</key> | |
| 11 | + <string>app-store</string> | |
| 12 | + <key>uploadBitcode</key> | |
| 13 | + <false/> | |
| 14 | + <key>uploadSymbols</key> | |
| 15 | + <false/> | |
| 16 | +</dict> | |
| 17 | +</plist> | ... | ... |
exportTest.plist
0 → 100755
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| 3 | +<plist version="1.0"> | |
| 4 | +<dict> | |
| 5 | + <key>method</key> | |
| 6 | + <string>ad-hoc</string> | |
| 7 | + <key>compileBitcode</key> | |
| 8 | + <false/> | |
| 9 | + <key>provisioningProfiles</key> | |
| 10 | + <dict> | |
| 11 | + <key>cn.gov.scio.live1</key> | |
| 12 | + <string>CNLiveNetPlusBusiness_DisPP</string> | |
| 13 | + </dict> | |
| 14 | +</dict> | |
| 15 | +</plist> | ... | ... |