簡體   English   中英

從 Xcode 構建腳本/ xcodebuild 中排除應用程序擴展 (WatchKit)

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

我們目前使用的 CI 服務適用於 iOS 8.1(如果我錯了,請糾正我)不支持 Apple Watch / WatchKit。 我已經對 Xcode 進行了一些搜索和探索,但無濟於事。

我正在尋找一種從構建中排除我的 Apple Watch 擴展的方法 - 通過在 Xcode 中Run Build Script ,或者更好的是直接通過 xcodebuild 命令執行此操作的方法。

有人有任何提示嗎?

查看您的[Main Target] > Build Phases > Target Dependencies[Main Target] > Build Phases > Embed App Extensions並從兩者中刪除 WatchKit 信息。

我正在使用 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); ?>

如有問題,請告訴我以供進一步討論。

如果您正在尋找腳本,您可以使用configure_extensions gem。

語法: configure_extensions <mode> <project> <app_target> <extensions...>

示例: configure_extensions add MyApp.xcodeproj MyApp NotificationsUI

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM