iOS SDK 对接文档

iOS SDK 对接文档


设置App的编译阶段 (Build Phases)

<h1>设置App的编译阶段 (Build Phases) (共3步)</h1> <p>1 在目标App的编译阶段(Build Phases)中,添加一个脚本运行阶段 (Run Script Phase)。 <img src="images/BuildPhases配置1.png" alt="" /> 2 请确认该脚本运行阶段放置在所有阶段的最后。 <img src="images/BuildPhases配置2.png" alt="" /> 3 将下面代码段的内容粘贴到新增的脚本运行阶段中。 <strong>在原有的脚本中,增强日志输入,以便于Debug</strong></p> <pre><code># Output Log to /tmp/*_BSSDKRunScript.log exec &amp;gt; /tmp/${PROJECT_NAME}_${TARGET_NAME}_BSSDKRunScript.log 2&amp;gt;&amp;amp;1 echo &amp;quot;Architectures trimming begins&amp;quot; APP_PATH=&amp;quot;${TARGET_BUILD_DIR}/${WRAPPER_NAME}&amp;quot; echo &amp;quot;APP_PATH:${APP_PATH}&amp;quot; # This script loops through the frameworks embedded in the application and # removes unused architectures. find &amp;quot;$APP_PATH&amp;quot; -name '*.framework' -type d | while read -r FRAMEWORK do FRAMEWORK_EXECUTABLE_NAME=$(defaults read &amp;quot;$FRAMEWORK/Info.plist&amp;quot; CFBundleExecutable) FRAMEWORK_EXECUTABLE_PATH=&amp;quot;$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME&amp;quot; echo &amp;quot;Executable is $FRAMEWORK_EXECUTABLE_PATH&amp;quot; EXTRACTED_ARCHS=() echo &amp;quot;Architectures to keep:${ARCHS}&amp;quot; for ARCH in $ARCHS do echo &amp;quot;Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME&amp;quot; lipo -extract &amp;quot;$ARCH&amp;quot; &amp;quot;$FRAMEWORK_EXECUTABLE_PATH&amp;quot; -o &amp;quot;$FRAMEWORK_EXECUTABLE_PATH-$ARCH&amp;quot; echo &amp;quot;$ARCH:$FRAMEWORK_EXECUTABLE_PATH-$ARCH&amp;quot; EXTRACTED_ARCHS+=(&amp;quot;$FRAMEWORK_EXECUTABLE_PATH-$ARCH&amp;quot;) done echo &amp;quot;EXTRACTED_ARCHS:&amp;quot; echo &amp;quot;${EXTRACTED_ARCHS}&amp;quot; echo &amp;quot;Merging extracted architectures: ${ARCHS}&amp;quot; lipo -o &amp;quot;$FRAMEWORK_EXECUTABLE_PATH-merged&amp;quot; -create &amp;quot;${EXTRACTED_ARCHS[@]}&amp;quot; echo &amp;quot;Remove ${EXTRACTED_ARCHS[@]}&amp;quot; rm &amp;quot;${EXTRACTED_ARCHS[@]}&amp;quot; echo &amp;quot;Replacing original executable with thinned version&amp;quot; echo &amp;quot;Remove $FRAMEWORK_EXECUTABLE_PATH&amp;quot; rm &amp;quot;$FRAMEWORK_EXECUTABLE_PATH&amp;quot; mv &amp;quot;$FRAMEWORK_EXECUTABLE_PATH-merged&amp;quot; &amp;quot;$FRAMEWORK_EXECUTABLE_PATH&amp;quot; done if [ $? -eq 0 ]; then echo &amp;quot;Architectures trimming is completed!&amp;quot; else echo &amp;quot;Architectures trimming is failed!!!&amp;quot; fi</code></pre> <p>4 该步骤设置结束,用于在生成App时,把非对应CPU架构的Binary给清掉,以减小<strong>App</strong>的大小。</p>

页面列表

ITEM_HTML