开发者

error:Interface type cannot be statically allocated ? map link

I have variable is: stateName = [store objectAtIndex:0];

and Country: country = [store objectAtIndex:1];

and I put code like this:

NSString* urlString = @"http://maps.google.com/maps?saddr=%@+
%@&daddr=Birmingham+UK",statName,country开发者_开发技巧;

I tried to put code like this:

NSString *test = [NSString stringWithFormat:@"%@", stateName];

NSString *urlString = @"http://maps.google.com/maps?saddr=%@+UK&daddr=Birmingham+UK",test;

It didn't work.

Thank you.


You need to use stringWithFormat if you're including object data in your string. So:

NSString* urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%@+%@&daddr=Birmingham+UK",stateName,country];

and

NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%@+UK&daddr=Birmingham+UK",test];

Hope this helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜