开发者

IOS String issues. one works, one doesn't, what gives?

开发者 https://www.devze.com 2023-04-08 21:09 出处:网络
from the .h NSString *_maplink; @property (nonatomic, retain) NSString *mapLink; in the .m this one is fine

from the .h

NSString *_maplink;
@property (nonatomic, retain) NSString *mapLink;

in the .m

this one is fine

NSString *link = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,+%f&daddr=thatCity+thatState+515+north+state+street", latitude, longitude];

i need the property later so i'm

mapLink = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,+%f&daddr=thatCity+thatState+515+north+state+street", latitude, longitude];

then i

NSLog(@"the map link %开发者_StackOverflow社区@", mapLink);

in a different function and I get the ole SIGABRT.

what's the dilly o?


Simply assigning your string to the mapLink variable won't retain it. You need to:

self.mapLink = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,+%f&daddr=thatCity+thatState+515+north+state+street", latitude, longitude];
0

精彩评论

暂无评论...
验证码 换一张
取 消