iOS app內部產生描述檔案(一)看破描述檔案

來源:互聯網
上載者:User

標籤:

  最近公司安排了一個項目 客戶的需求如下

    1、app輸入APN參數後 本機產生描述設定檔(也就是不要用apple配置.app ,現在改名叫Apple configurator.app) 

    2、描述檔案需要本機直接安裝 

  其他的就不說了

 

  我根本不會,所以網上的搜了一些文章,有用的不多。但是有一篇給了一個重要的提示,是一個PDF的名字:Enterprise_Deployment_Guide_CH.pdf。 這本書apple官網已經沒有連結了,至少我沒有搜尋到。不多度娘還是蠻好的,可以下載到。這裡面講了iPhone設定檔的一些重要參數以及格式。 

  PDF裡面的例子看上去是XML寫的,不過細細研究一下。XML的格式是蘋果自訂的,我猜想是不是Plist。幸運的是,我猜對了。。。

 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>PayloadContent</key> 6     <array> 7         <dict> 8             <key>PayloadContent</key> 9             <array>10                 <dict>11                     <key>DefaultsData</key>12                     <dict>13                         <key>apns</key>14                         <array>15                             <dict>16                                 <key>apn</key>17                                 <string>1</string>18                                 <key>username</key>19                                 <string>2</string>20                                 <key>password</key>21                                 <string>3</string>22                             </dict>23                         </array>24                     </dict>25                     <key>DefaultsDomainName</key>26                     <string>com.apple.managedCarrier</string>27                 </dict>28             </array>29             <key>PayloadDescription</key>30             <string>xxxx</string>31             <key>PayloadDisplayName</key>32             <string>APN描述檔案</string>33             <key>PayloadIdentifier</key>34             <string>xxxxxx</string>35             <key>PayloadOrganization</key>36             <string>xxxx</string>37             <key>PayloadType</key>38             <string>com.apple.apn.managed</string>39             <key>PayloadUUID</key>40             <string>9A8C3A97-4FDF-49BA-979D-B256ECD73427</string>41             <key>PayloadVersion</key>42             <integer>1</integer>43         </dict>44     </array>45     <key>PayloadDescription</key>46     <string>裝置配置的描述檔案</string>47     <key>PayloadVersion</key>48     <integer>1</integer>49     <key>PayloadDisplayName</key>50     <string>APN</string>51     <key>PayloadUUID</key>52     <string>DC8AD461-A7E3-4E0C-B656-A556457644AC</string>53     <key>PayloadType</key>54     <string>Configuration</string>55     <key>PayloadOrganization</key>56     <string>xxxxx</string>57     <key>PayloadIdentifier</key>58     <string>xxxx</string>59     <key>PayloadRemovalDisallowed</key>60     <false/>61 </dict>62 </plist>

  喜歡嘗試的coder,可以在Xcode裡面見一個plist或者.mobileconfig的檔案 把代碼拷貝進去。TIPS:會XML的可以直接看啦,不會的話,右擊->Open As->ASCII Property Plist  然後你就見到熟悉的Plist結構啦。。。

這裡面的配置參數 請參考上面提到的PDF。說明一點 配置分兩塊 一個是Root 也就是最外面的架構,許多參數PDF都有說明;Root裡面還有一個配置,結構類似,那是配置的主體 (可以有多個主體配置) , 然後呢 plist是一個NSDictionary,讀取的話應該沒問題的咯。

  好啦,描述檔案我們已經看清了。

  To Be Continue  。。。

iOS app內部產生描述檔案(一)看破描述檔案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.