objective c - Check string containing URL for "http://" -
i trying check url entered user, fighting against errors , warnings. -(bool) textfieldshouldreturn:(uitextfield *)textfield { //check "http://" nsstring *check = textfield.text; nsstring *searchstring = @"http://"; nsrange resultrange = [check rangewithstring:searchstring]; bool result = resultrange.location != nsnotfound; if (result) { nsurl *urladdress = [nsurl urlwithstring: textfield.text]; } else { nsstring *good = [nsstring stringwithformat:@"http://%@", [textfield text]]; nsurl *urladdress = [nsurl urlwithstring: good]; } // open url nsurlrequest *requestobject = [nsurlrequest requestwithurl:urladdress]; they : nsstring may not respond -rangewithstring unused variable urladdress in condition "if … else" (for both) urladdress undeclared : in urlrequest does have idea do? nsstring responds rangeofstring: , not rangewithstring: . the variable urlad...