Ios 使用AppleScript或以编程方式删除Xcode项目中的文件或组
首先也是最重要的,我在这里试图实现的目标是使用自动化删除Xcode项目中一些不需要的文件 我曾尝试使用AppleScript启动Xcode并命令它删除某些文件,但到目前为止没有成功,下面是我的AppleScript用于删除Ios 使用AppleScript或以编程方式删除Xcode项目中的文件或组,ios,xcode,automation,applescript,Ios,Xcode,Automation,Applescript,首先也是最重要的,我在这里试图实现的目标是使用自动化删除Xcode项目中一些不需要的文件 我曾尝试使用AppleScript启动Xcode并命令它删除某些文件,但到目前为止没有成功,下面是我的AppleScript用于删除 tell application "Xcode" open ("/Users/bulbasaur/Desktop/ios/Tutorial.xcworkspace") set testproject to project "Tutorial" tell
tell application "Xcode"
open ("/Users/bulbasaur/Desktop/ios/Tutorial.xcworkspace")
set testproject to project "Tutorial"
tell testproject
set rootgroup to group "Tutorial-iPhone"
tell rootgroup
delete file reference "main.h" of group "Classes"
end tell
end tell
end tell
我犯了一个错误
error "Xcode got an error: AppleEvent handler failed." number -10000
所以问题是,
请注意,通过Finder或Terminal删除不起作用,因为Finder不会删除Xcode项目(Project.pbxproj)中的引用链接。我没有检查所有脚本,但是,首先,将打开的文件路径更改为使用Finder path而不是Unix path:
open ("Users:bulbasaur:Desktop:iOS:Tutorial.xcworkspace")
对于其余内容,请打开Applescript编辑器,将Xcode添加到Applescript库中,您将看到所有可能的Xcode说明。我没有检查您的所有脚本,但首先,将打开的文件路径更改为使用查找器路径而不是Unix路径:
open ("Users:bulbasaur:Desktop:iOS:Tutorial.xcworkspace")
对于其余内容,请打开Applescript编辑器,将Xcode添加到Applescript库中,您将看到所有可能的Xcode说明。Hi@pbell我已按照您的建议将文件路径更改为,并将Xcode添加到我的库中(通过Windows>library)。我尝试通过以下代码删除该文件“set testproject to project”Tutorial“tell testproject set rootgroup to group”Tutorial“tell rootgroup delete file reference”temp.h“of rootgroup end tell end tell”,但到目前为止没有突破。。哈哈。。。请建议^。^另外,我将代码更改为“删除根组的“temp.h”,并出现错误“无法获取根组的“temp.h”。不允许访问。“有什么想法吗?您好@pbell,我已按照您的建议将文件路径更改为,并将Xcode添加到我的库中(通过Windows>库)。我尝试通过以下代码删除该文件“set testproject to project”Tutorial“tell testproject set rootgroup to group”Tutorial“tell rootgroup delete file reference”temp.h“of rootgroup end tell end tell”,但到目前为止没有突破。。哈哈。。。请告知^。^另外,我将代码更改为“删除根组的“temp.h”,并出现错误“无法获取根组的“temp.h”。不允许访问。有什么想法吗?