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.
精彩评论