objective-c : if statement not working properly -
this isn't whole code i'm trying textview box , see if value has been put in. if not want first bit if not want go else... whatever crashes or doesn't work.
-(ibaction) sendpressed{ if((youtubeurl.text = @"")){ //if doesnt have value nslog(@"no youtube clip"); youtubelink = @""; } else{ //if youtube url has been entered nslog(@"youtube clip found"); completeurl = youtubeurl.text; youtubelink = [completeurl substringfromindex:16]; }
your if statement performing assignment. intend performing comparison. also, should not use ==
comparison of nsstring
s. try this:
- (ibaction)sendpressed { if([youtubeurl.text isequaltostring:@""]) { //if doesnt have value nslog(@"no youtube clip"); youtubelink = @""; } else{ //if youtube url has been entered nslog(@"youtube clip found"); completeurl = youtubeurl.text; youtubelink = [completeurl substringfromindex:16]; } }
Comments
Post a Comment