ios - 如何通过 XCode 模板添加 swift 编译器自定义标志
<p><p>我尝试通过 XCode 模板在目标中添加 swift 编译器自定义标志</p>
<p><strong>默认</strong></p>
<p> <a href="/image/NsBDm.png" rel="noreferrer noopener nofollow"><img src="/image/NsBDm.png" alt="swift compiler custom flag in target"/></a> </p>
<hr/>
<pre><code><key>Targets</key>
<array>
<dict>
<key>Configurations</key>
<dict>
<key>Debug</key>
<dict/>
<key>Release</key>
<dict/>
</dict>
<key>Name</key>
<string>___PACKAGENAME___</string>
<key>SharedSettings</key>
<dict>
<key>OTHER_SWIFT_FLAGS</key>
<array>
<key>Debug</key>
<string>-DDEBUG</string>
</array>
</dict>
</dict>
</array>
</code></pre>
<hr/>
<p><strong>模板</strong></p>
<p> <a href="/image/NsBDm.png" rel="noreferrer noopener nofollow"><img src="/image/NsBDm.png" alt="Xcode Templates"/></a> </p>
<p>我只想访问调试 key 。有可能吗?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>你快到了! </p>
<p><code>TemplateInfo.plist</code> 应该是这样的</p>
<pre><code><key>Targets</key>
<array>
<dict>
<key>Configurations</key>
<dict>
<key>Debug</key>
<dict>
<key>OTHER_SWIFT_FLAGS</key>
<array>
<string>-DDEBUG</string>
</array>
</dict>
</dict>
</dict>
</array>
</code></pre>
<p> <img src="/image/dKaBL.png" alt="TemplateInfo.plist"/> </p>
<p>这是结果</p>
<p> <img src="/image/oeN95.png" alt="Build Settings"/> </p></p>
<p style="font-size: 20px;">关于ios - 如何通过 XCode 模板添加 swift 编译器自定义标志,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/37163231/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/37163231/
</a>
</p>
页:
[1]