开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜