Ian*_*ner 1 xcode cocoa warnings
我在Cocoa应用程序中运行的一些Applescripts中弹出以下警告:
http://emberapp.com/splash6/images/unknown-escape-sequence-error/sizes/m.png
我已经尝试了所有我能想到的删除错误,例如完全重写它,从另一个没有警告等的类似脚本复制和粘贴但我无法摆脱它.谁能告诉我哪里可能出错了.
我正在使用的原始代码是:
NSString *theCellRefScript = [NSString stringWithFormat:@"tell application \"Numbers\"\n\
tell document 1 \n\
tell sheet \"%@\" \n\
tell table \"%@\" \n\
set value of cell \"%@\" to \%@\ \n\
end tell \n\
end tell \n\
end tell \n\
end tell ", theSheet, theTable, theCell, [theDistributionValues objectAtIndex:k]];
Run Code Online (Sandbox Code Playgroud)
小智 8
首先,不要让自己打开这种问题.
与所有现代C编译器一样,Objective-C会自动连接字符串文字,如果它们是由空格分隔的话.使用:而不是你的多线恐怖与其斜杠,使用:
NSString *theCellRefScript = [NSString stringWithFormat:@"tell application \"Numbers\"\n"
"tell document 1\n"
"tell sheet \"%@\ \n"
"tell table \"%@\ \n"
"set value of cell \"%@\" to \%@ \n"
"end tell\n"
"end tell\n"
"end tell\n"
"end tell", theSheet, theTable, theCell, [theDistributionValues objectAtIndex:k]];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7689 次 |
| 最近记录: |