如果在手机上的safari访问我们的服务器 https://192.168.x.xxx,会有一个框跳出来‘Cann't Verify Server Identify’,此时一定要点cancel。否则safari就会把这个网站加入到一个ssl异常列表,即便是你的ssl证书有问题,下一次你访问这个站点,safari也不会发出警告,只有General->Reset-Reset All settings来重置IpHone了。。
4. Export adhoc 版的ipa
创建Adhoc Discribution Provision Profile,并勾选相应的手机udid。然后在Xcode导出ipa时勾选Save for Enterprise Distribution并填写如下信息
Application URL:https://192.168.x.xx/xx/xx.ipa
Title: XXXX
根据目录里的文件自动创建adhoc app下载列表的php代码:
记得替换192.168.x.xx为你自己的ip:
<html> <head> <style type="text/css"> html,body { padding: 0; margin: 0; width: 100%; height: 100%; font-family: Helvetica; border: 0px solid red; } h1 { margin-top: 20px; text-align: center; } #apps_container { width: 90%; margin: 0 auto; border: 0px solid blue; } #apps_container table { border: 1px solid green; border-radius: 10px; width: 100%; } #apps_container td { border-top:1px solid green; } .app_title_container { margin-left: 20px; margin-right: 2px; margin-top: 25px; margin-bottom: 25px; line-height: 30px; font-size: 30px; font-weight: bold; } .app_install_button { margin-left: 2px; margin-right: 20px; margin-top: 25px; margin-bottom: 25px; text-align: right; line-height: 30px; font-size: 30px; } </style> </head> <body> <h1>Adhoc applications</h1> <div id="apps_container"> <table cellspacing="0"> <?php function getFileList( $dir ) { $fileArray = array(); if( is_dir($dir) ) { $handle = opendir($dir); if( $handle ) { while( ($file = readdir($handle)) ) { if( $file != '.' && $file != '..' && $file != ".DS_Store") { array_push($fileArray, $file); } } closedir( $handle ); } } return $fileArray; } $fileArray = getFileList("."); $firstRow = true; for ($i=0; $i < count($fileArray); $i++) { $fileName = $fileArray[$i]; if (stristr($fileName, ".plist")) { $extraStyle = ""; if ($firstRow) { $extraStyle = ' style="border-width:0;" '; $firstRow = false; } $install_link = '<a href="itms-services://?action=download-manifest&url=https://192.168.x.xx/ios/' . $fileName . '">'; $install_link = $install_link . "Install APP" . "</a>"; // Find a .plist file. $appName = str_ireplace(".plist", ".ipa", $fileName); echo "<tr>"; echo " <td " . $extraStyle . ">"; echo " <div class='app_title_container'>" . $appName . "</div>"; echo " </td>"; echo " <td " . $extraStyle . ">"; echo " <div class='app_install_button'>" . $install_link . "</div>"; echo " </td>"; echo "</tr>"; } } ?> </table> </div> </body> </html>