简体   繁体   中英

Can't return a String value and append it…why?

I am writing an app and am having problems returning a simple string value, and I'm not sure why.

The function I am using (within a file called APIManager.m) is:

- (NSString*) returnVenueUrl {
NSString *venueUrl = [devEnvironment stringByAppendingString:@"venue/id/"];
return venueUrl;

}

I can return this properly by doing this in another .m file:

APIManager *apiManager = [APIManager apiManager];
NSLog(@"view venue URL is here: %@", [apiManager returnVenueUrl]);

But when I go to append a variable cast as a String onto it, I get nothing..

venueURL = [apiManager returnVenueUrl];
venueURL = [venueURL stringByAppendingString:venueId];

NSLog(@"the Full Venue URL is: %", venueURL);

If anyone has any advice on how to fix this, it would be much appreciated!

使用NSMutableString NSString是不可变的(aka不可修改)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM