2017-07-13 48 views
-1

我已經創建了自定義ios項目模板,並添加了爲您的項目嚮導選擇選項中添加的名稱,電子郵件和移動選項,並且它們對於項目創建(PFA)是必需的。如何在創建項目後獲取這些選項值。如何在Xcode 8 iOS項目嚮導中獲取自定義選項值?

Custom project template wizard

TemplateInfo.plist:

<plist version="1.0"> 
<dict> 
    <key>Kind</key> 
    <string>Xcode.Xcode3.ProjectTemplateUnitKind</string> 
    <key>Identifier</key> 
    <string>com.test</string> 
    <key>Ancestors</key> 
    <array> 
     <string>com.apple.dt.unit.storyboardApplication</string> 
     <string>com.apple.dt.unit.coreDataCocoaTouchApplication</string> 
    </array> 
    <key>Concrete</key> 
    <true/> 
    <key>Description</key> 
    <string>This template provides a starting point for an application that uses a single view. It provides a view controller to manage the view, and a storyboard or nib file that contains the view.</string> 
    <key>SortOrder</key> 
    <integer>1</integer> 
    <key>Options</key> 
    <array> 
    <dict> 
     <key>Description</key> 
      <string>Name.</string> 
     <key>EmptyReplacement</key> 
      <string>Name</string> 
     <key>Identifier</key> 
      <string>Name</string> 
     <key>Name</key> 
      <string>Name</string> 
     <key>NotPersisted</key> 
      <true/> 
     <key>Required</key> 
      <true/> 
     <key>Type</key> 
      <string>text</string> 
    </dict> 
    <dict> 
     <key>Description</key> 
      <string>Email address.</string> 
     <key>EmptyReplacement</key> 
      <string>Email</string> 
     <key>Identifier</key> 
      <string>Email</string> 
     <key>Name</key> 
      <string>Email</string> 
     <key>NotPersisted</key> 
      <true/> 
     <key>Required</key> 
      <true/> 
     <key>Type</key> 
      <string>text</string> 
    </dict> 
    <dict> 
     <key>Description</key> 
      <string>Mobile number.</string> 
     <key>EmptyReplacement</key> 
      <string>Mobile</string> 
     <key>Identifier</key> 
      <string>Mobile</string> 
     <key>Name</key> 
      <string>Mobile</string> 
     <key>NotPersisted</key> 
      <true/> 
     <key>Required</key> 
      <true/> 
     <key>Type</key> 
      <string>text</string> 
    </dict> 
     <dict> 
      <key>Identifier</key> 
      <string>languageChoice</string> 
      <key>Units</key> 
      <dict> 
       <key>Swift</key> 
       <dict> 
        <key>Nodes</key> 
        <array> 
         <string>AppDelegate.swift</string> 
         <string>ViewController.swift</string> 
        </array> 
       </dict> 
      </dict> 
     </dict> 
    </array> 
    <key>Definitions</key> 
    <dict> 
     <key>Base.lproj/Main.storyboard</key> 
     <dict> 
      <key>Path</key> 
      <string>Main.storyboard</string> 
      <key>SortOrder</key> 
      <integer>99</integer> 
     </dict> 
     <key>AppDelegate.swift</key> 
     <dict> 
      <key>Path</key> 
      <string>AppDelegate.swift</string> 
     </dict> 
     <key>ViewController.swift</key> 
     <dict> 
      <key>Path</key> 
      <string>ViewController.swift</string> 
     </dict> 
    </dict> 
</dict> 
</plist> 
+0

你可以發佈你使用這個模板文件? –

+0

我已經添加了TemplateInfo.plist – boopathy

+0

我已經看過了,而且我無法解決它。實際上缺少在線文檔。抱歉。 –

回答

0
<key>Identifier</key> 
<string>name</string> 

自定義選項值此格式___VARIABLE_identifier___創建。 你可以使用名稱期權價值之本___VARIABLE_name___