相关疑难解决方法(0)

在哪里为app设置环境变量?

我正在使用冻结且无法更改的源代码; 但它的ENV意识到并期望通过ENV进行更改.源代码正在Xcode 4/iOS项目中使用.

Xcode 3允许我们在Executable文件夹中的应用程序上设置环境变量(参见iOS Debugging Magic中的图1 ).Xcode 4似乎缺少Xcode 3中的"可执行信息".

我在Stack Overflow上查看了许多类似的问题,但没有人回答过这些问题.答案通常会退化为预处理器宏.Confer:如何使用XCode 4在iPhone可执行文件中设置环境变量?,Xcode中的条件环境变量,以及在ios中设置环境变量的位置

如何在Xcode 4中设置应用程序的环境变量?

environment-variables ios xcode4 xcode4.6

29
推荐指数
1
解决办法
2万
查看次数

Xcode没有找到Mogenerator

我正在尝试在Xcode 5中开发的iOS项目中使用Mogenerator.我已经使用brew安装了Mogenerator:

brew install mogenerator
Run Code Online (Sandbox Code Playgroud)

然后链接:

brew link mogenerator
Run Code Online (Sandbox Code Playgroud)

之后,我可以从命令行访问此工具.

接下来我试图在构建阶段(shell/bin/sh)中再添加一个步骤(脚本执行):

mogenerator --model "${PROJECT_DIR}/MyProject/Model.xcdatamodeld/Model.xcdatamodel" --output-dir "${PROJECT_DIR}/MyProject" --template-var arc=true
Run Code Online (Sandbox Code Playgroud)

实际上我得到错误:

line 2: mogenerator: command not found
Command /bin/sh failed with exit code 127
Run Code Online (Sandbox Code Playgroud)

您有什么建议可以解决这个问题吗?

xcode ios mogenerator xcdatamodel

15
推荐指数
1
解决办法
6266
查看次数

NSTask没有从用户的环境中获取$ PATH

我不知道为什么这个方法返回一个空字符串:

- (NSString *)installedGitLocation {
    NSString *launchPath = @"/usr/bin/which";

    // Set up the task
    NSTask *task = [[NSTask alloc] init];
    [task setLaunchPath:launchPath];
    NSArray *args = [NSArray arrayWithObject:@"git"];
    [task setArguments:args];

    // Set the output pipe.
    NSPipe *outPipe = [[NSPipe alloc] init];
    [task setStandardOutput:outPipe];

    [task launch];

    NSData *data = [[outPipe fileHandleForReading] readDataToEndOfFile];
    NSString *path = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];

    return path;
}
Run Code Online (Sandbox Code Playgroud)

如果不是@"git"作为参数传递,我传递@"which"/usr/bin/which按预期返回.所以至少原理是有效的.

从终端

$ which which
$ /usr/bin/which
$
$ which git
$ /usr/local/git/bin/git
Run Code Online (Sandbox Code Playgroud)

所以它在那里工作. …

bash shell cocoa objective-c nstask

13
推荐指数
2
解决办法
8315
查看次数

iphone构建错误让我想要买钉枪

我只是想为iphone应用程序构建一个简单的更新(我之前已经做过),但现在由于某种原因我收到了这个错误.谁能告诉我它意味着什么?

Command/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist failed with exit code 127
sh: plutil: command not found
Run Code Online (Sandbox Code Playgroud)

以下是构建结果:

CopyPNGFile /Users/me/path/build/Dist-iphoneos/MyApp.app/img_000.png images/img_000.png
    cd /Users/me/
    setenv COPY_COMMAND /Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp
    setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/System/Library/Frameworks/JavaVM.frameworK/Versions/1.6/Home/"
    "/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneOS Build System Support.xcplugin/Contents/Resources/copypng" -compress "" /Users/path/images/img_000.png /Users/me/path/build/Dist-iphoneos/MyApp.app/img_000.png
sh: dirname: command not found

CopyPlistFile /Users/me/path/build/Dist-iphoneos/MyApp.app/Entitlements.plist Entitlements.plist
    cd /Users/me/
    setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/System/Library/Frameworks/JavaVM.frameworK/Versions/1.6/Home/"
    /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist --convert binary1 Entitlements.plist --outdir /Users/me/path/build/Dist-iphoneos/MyApp.app
sh: plutil: command not found
Run Code Online (Sandbox Code Playgroud)

iphone xcode build

12
推荐指数
1
解决办法
7383
查看次数

XCode无法识别环境变量

我使用以下脚本在OSX Yosemite 10.10.5上运行XCode(7.0.1 7A1001):

export FOO=bar #this should not be necessary, but just in case
launchctl setenv FOO bar #should make it visible to all GUI applications (=XCode)
open -a xcode
Run Code Online (Sandbox Code Playgroud)

然后我打开一个包含两个项目的工作区:App1App2.在这两个项目中,我都放入$(HOME)/$(FOO)Header Search Paths字段.

  • App1中,/Users/ohads/bar按预期解决.
  • App2中,它决定/Users/ohads/- 注意HOME变量是如何解析的,但FOO变量不是.

这里发生了什么?为什么会出现差异?我如何FOO在App2中工作 - 是否有一些我失踪的特殊标志或声明?

顺便说一句,好像这并不奇怪,App1即使在我只使用时也能正常工作export(相launchctl对于GUI应用程序应该使用的那个,看起来export应该只影响现金应用程序).

bash xcode environment-variables xcconfig

3
推荐指数
1
解决办法
2008
查看次数