我做我的应用程序的注册过程,其中用户在一个数字,我核对我的分贝进入..反正长话短说,我通过代码到我的NSString * startURL有一个警告,我无法摆脱的,它说如何解决Xcode的警告“表达式结果未使用”
“表达式结果未使用”
你有没有经历过这样的事,如果让我怎么解决?
-(void)startRegConnect:(NSString *)tempRegCode{
//tempRegCode = S.checkString;
NSLog(@"tempRegCode from RegConnection =%@",tempRegCode);
NSString *code = [[NSString alloc] initWithString:tempRegCode];
//urlstart string
NSString *startURL = (@"http://188.162.17.44:8777/ICService/?RegCode=%@",code); //warning here
NSURL *url = [NSURL URLWithString:startURL];
//create a request object with that url
NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30];
//clear out the exisiting connection if there is on
if (connectionInProgress) {
[connectionInProgress cancel];
[connectionInProgress release];
}
//Instantiate the object to hold all incoming data
[cookieData release];
cookieData = [[NSMutableData alloc]init];
//create and initiate the connection - non-blocking
connectionInProgress = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
}
这不是你的问题的答案,但你为什么要分配一个新的字符串('code'),然后为它指定tempRegCode的值?你可以毫无问题地使用tempRegCode。 – sosborn
我只是这样做,认为它可以解决这个问题,因为我不知道为什么会发生问题,我认为这可能是奇怪的,因为我改变了我的代码,而没有将传入的字符串传递给另一个字符串。 –
公平 - 我们都有过这些时刻:) – sosborn