itms-services協議:跳轉網頁部署及PHP動態產生 iOS渠道包IPA一鍵安裝之plist

來源:互聯網
上載者:User
相信很多人嘗試過使用揣果測試庫(http://ipa.chuaiguo.com/)的無線安裝測試IPA安裝包功能。有心人一定注意到其itms-services協議的一鍵安裝地址的url=部分並不是我們常見的plist檔案路徑,而是一個install.php通過增加參數的形式自動產生輸出了plist。之前因為筆者的項目中渠道包不多,所以懶得去寫這樣一個檔案協助部署,可是最近,筆者的項目的渠道包不斷增多了,顯然部署多個plist檔案管理上似乎越來越麻煩了,於是筆者開始仿照揣果實現了並結合自己項目的需求,實現了PHP動態產生 iOS渠道包IPA一鍵安裝之plist。這裡跟大家分享一下,希望對您有所協助。

 iOS 一鍵安裝下載中...
 startElement('dict'); foreach($dict as $k => &$v)  { $x->writeElement('key', $k); xmlWriteValue($x, $v); } $x->endElement();}  //向xml節點中寫入數組(array)function xmlWriteArray(XMLWriter $x, &$arr) { $x->startElement('array'); foreach($arr as &$v) xmlWriteValue($x, $v); $x->endElement();}//根據類型向xml節點中寫入值function xmlWriteValue(XMLWriter $x, &$v) { if (is_int($v) || is_long($v)) $x->writeElement('integer', $v); elseif (is_float($v) || is_real($v) || is_double($v)) $x->writeElement('real', $v); elseif (is_string($v)) $x->writeElement('string', $v); elseif (is_bool($v)) $x->writeElement($v?'true':'false'); elseif (isDict($v)) xmlWriteDict($x, $v); elseif (is_array($v)) xmlWriteArray($x, $v); else  { trigger_error("Unsupported data type in plist ($v)", E_USER_WARNING); $x->writeElement('string', $v); }}//建立plistfunction createplist(){ $ssl_server = 'https://www.lessney.com/'; $target_name = 'Sample'; $bundle_identifier = 'com.lessney.' . $target_name; $subtitle = 'Zero Status Inc.'; $title = '樣本程式'; $versionname = $_GET['v']; if (!$versionname)  { $versionname = '1.0.0'; } $versioncode = str_replace('.', '', $versionname); $channelid = $_GET['cid']; if (!$channelid)  { $channelid = '0'; } header('Content-Type: application/xml'); $plist = new XmlWriter(); $plist->openMemory(); $plist->setIndent(TRUE); $plist->startDocument('1.0', 'UTF-8'); $plist->writeDTD('plist', '-//Apple//DTD PLIST 1.0//EN', 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'); $plist->startElement('plist'); $plist->writeAttribute('version', '1.0'); $pkg = array(); $pkg['kind'] = 'software-package'; $pkg['url'] = $ssl_server . $target_name .'_v' . $versioncode . '_' .$channelid . '.ipa'; $displayimage = array(); $displayimage['kind'] = 'display-image'; $displayimage['needs-shine'] = TRUE; $displayimage['url'] = $ssl_server . 'Icon.png'; $fullsizeimage = array(); $fullsizeimage['kind'] = 'full-size-image'; $fullsizeimage['needs-shine'] = TRUE; $fullsizeimage['url'] = $ssl_server . 'iTunesArtwork.png'; $assets = array(); $assets[] = $pkg; $assets[] = $displayimage; $assets[] = $fullsizeimage; $metadata = array(); $metadata['bundle-identifier'] = $bundle_identifier; $metadata['bundle-version'] = $versionname; $metadata['kind'] = 'software'; $metadata['subtitle'] = $subtitle; $metadata['title'] = $title; $items0 = array(); $items0['assets'] = $assets; $items0['metadata'] = $metadata; $items = array(); $items[] = $items0; $root = array(); $root['items'] = $items; xmlWriteValue($plist, $root); $plist->endElement(); $plist->endDocument(); return $plist->outputMemory();}//輸出plistecho createplist();?>
  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.