【问题标题】:Exclude App Extension (WatchKit) from Xcode build script / xcodebuild从 Xcode 构建脚本/xcodebuild 中排除 App Extension (WatchKit)
【发布时间】:2015-04-15 18:37:50
【问题描述】:

我们目前使用的 CI 服务适用于 iOS 8.1(如果我错了,请纠正我)不支持 Apple Watch / WatchKit。我在 Xcode 上进行了一些搜索和探索,但无济于事。

我正在寻找一种从构建中排除我的 Apple Watch 扩展的方法 - 通过 Xcode 中的 Run Build Script,或者更好的是直接通过 xcodebuild 命令执行此操作。

有人有什么建议吗?

【问题讨论】:

    标签: ios xcode xcodebuild watchkit xcode-6.2


    【解决方案1】:

    查看您的 [Main Target] > Build Phases > Target Dependencies[Main Target] > Build Phases > Embed App Extensions 并从两者中删除 WatchKit 信息。

    【讨论】:

    • 感谢您的回复 - 这确实有效,但我希望我可以使用某种脚本,然后我可以使用标志触发进行测试 - 这样我们就可以保留应用程序扩展Dev / Beta / etc的目标,但没有用于测试
    • @Killian 我正在尝试做类似的事情你找到答案了吗?
    【解决方案2】:

    我正在使用 PHP 脚本从项目运行时中删除扩展的 appex 文件。

    <?php
    $file = file_get_contents("./PROJECT_Name.xcodeproj/project.pbxproj");
    $emKeyPosition = strpos($file, "/* EXTENSION NAME */ = {
    			isa = PBXNativeTarget;");
    $bPhPosition = strpos($file, "buildPhases = (", $emKeyPosition);
    $endPosition = strpos($file, ");", $emKeyPosition);
    $emString = "Embed Pods Frameworks */,";
    $emFramePosition = strpos($file, $emString, $bPhPosition);
    $filelen = strlen($file);
    $previousComma = strrpos($file, ",", -($filelen-$emFramePosition));
    $finalFmString = substr($file, $previousComma+1, $emFramePosition+strlen($emString)-$previousComma);
    $file = str_replace($finalFmString, "", $file);
    file_put_contents("./PROJECT_Name.xcodeproj/project.pbxproj", $file);
    ?>

    如果有问题需要进一步讨论,请告诉我。

    【讨论】:

      【解决方案3】:

      如果您正在寻找脚本,您可以使用configure_extensions gem。

      语法:configure_extensions &lt;mode&gt; &lt;project&gt; &lt;app_target&gt; &lt;extensions...&gt;

      例如:configure_extensions add MyApp.xcodeproj MyApp NotificationsUI

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-10-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多