我有一个用于C++的跨平台单元测试框架.为了在XCode 6.1中构建和运行测试,我需要运行python脚本作为预构建脚本的一部分.
因为我对多个项目使用相同的单元测试框架,所以我认为在我的环境变量中使用环境变量~/.bash_profile指向python脚本所需的资源会很棒.但似乎XCode 6.1 bash_profile在构建过程中运行脚本之前没有加载.有没有替代品使用bash_profile?也许我可以将我的环境变量添加到XCode环境变量列表中?但这似乎随着OSX的每次更新而改变.我似乎无法弄清楚我可以在哪里为XCode 6.1添加环境变量.
我在pastebin上看到了一个长轮询技术的例子,我想知道设计的递归性质是否会导致堆栈溢出?对不起,如果这是一个菜鸟问题,但我不熟悉长轮询,我对objective-c不太熟悉.
//long polling in objective-C
- (void) longPoll {
//create an autorelease pool for the thread
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
//compose the request
NSError* error = nil;
NSURLResponse* response = nil;
NSURL* requestUrl = [NSURL URLWithString:@"http://www.mysite.com/pollUrl"];
NSURLRequest* request = [NSURLRequest requestWithURL:requestUrl];
//send the request (will block until a response comes back)
NSData* responseData = [NSURLConnection sendSynchronousRequest:request
returningResponse:&response error:&error];
//pass the response on to the handler
//(can also check for errors here, if you want)
[self performSelectorOnMainThread:@selector(dataReceived:)
withObject:responseData waitUntilDone:YES]; …Run Code Online (Sandbox Code Playgroud)