简体   繁体   English

从 Xcode 构建脚本/ xcodebuild 中排除应用程序扩展 (WatchKit)

[英]Exclude App Extension (WatchKit) from Xcode build script / xcodebuild

The CI service we are using at the moment works from iOS 8.1 which (correct me if I'm wrong) does not support the Apple Watch / WatchKit.我们目前使用的 CI 服务适用于 iOS 8.1(如果我错了,请纠正我)不支持 Apple Watch / WatchKit。 I've done some searching and poking around Xcode, but to no avail.我已经对 Xcode 进行了一些搜索和探索,但无济于事。

I'm looking for a way to exclude my Apple Watch extension from the build - either through Run Build Script in Xcode, or what would be even better is a way to do it directly through the xcodebuild command.我正在寻找一种从构建中排除我的 Apple Watch 扩展的方法 - 通过在 Xcode 中Run Build Script ,或者更好的是直接通过 xcodebuild 命令执行此操作的方法。

Anyone have any tips?有人有任何提示吗?

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

I am using a PHP script to remove the extension's appex file from the project runtime.我正在使用 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); ?>

Let me know in case of issues for further discussion .如有问题,请告诉我以供进一步讨论。

If you are looking for a script, You can use configure_extensions gem.如果您正在寻找脚本,您可以使用configure_extensions gem。

Syntax: configure_extensions <mode> <project> <app_target> <extensions...>语法: configure_extensions <mode> <project> <app_target> <extensions...>

Example: configure_extensions add MyApp.xcodeproj MyApp NotificationsUI示例: configure_extensions add MyApp.xcodeproj MyApp NotificationsUI

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM