我做我的應用程序的註冊過程,其中用戶在一個數字,我覈對我的分貝進入..反正長話短說,我通過代碼到我的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