开发者

error:Interface type cannot be statically allocated ? map link

开发者 https://www.devze.com 2023-03-12 12:20 出处:网络
I have variable is: stateName = [store objectAtIndex:0]; and Country: country = [store objectAtIndex:1];

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

精彩评论

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

关注公众号