how to fix xcode warning “Expression result unused”

I am doing a registration process with my app where the user enters in a number that I check against my db.. anyway long story short where I pass code into my NSString *startURL have a warning I cannot get rid of, it says

“Expression result unused”

  • Iphone app archive - No such file or directory
  • How to retrieve the list of top 1000 games in the iOS App Store in real-time
  • IOS Swift - Can't retrive person note from addressbook
  • NSString replace repeated newlines with single newline
  • Swift - How can I get a list of all photos and videos on iPhone?
  • Xcode 8 automatic build when any change
  • have you ever experienced anything like this and if so how do I fix it?

       -(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];
    
        }
    

    2 Solutions Collect From Internet About “how to fix xcode warning “Expression result unused””

    You can’t just do (@"http://188.162.17.44:8777/ICService/?RegCode=%@",code). Use [NSString stringWithFormat:@"http://188.162.17.44:8777/ICService/?RegCode=%@", tempRegCode].

    It’s because of the parenthesis. By writing (blabla) it becomes an expression, which you are not using as an expressing, hence the compiler complains.

    Change to [NSString stringWithFormat: ...]; and it becomes a method.