Ios4 错误:无法静态分配接口类型?地图链接

Ios4 错误:无法静态分配接口类型?地图链接,ios4,cocos2d-iphone,ios-simulator,iphone,Ios4,Cocos2d Iphone,Ios Simulator,Iphone,我有一个变量是:stateName=[storeobjectatindex:0] 和国家:Country=[storeobjectatindex:1] 我把代码放在下面: NSString* urlString = @"http://maps.google.com/maps?saddr=%@+ %@&daddr=Birmingham+UK",statName,country; NSString *test = [NSString stringWithFormat:@"%@", stat

我有一个变量是:
stateName=[storeobjectatindex:0]

和国家:
Country=[storeobjectatindex:1]

我把代码放在下面:

NSString* urlString = @"http://maps.google.com/maps?saddr=%@+
%@&daddr=Birmingham+UK",statName,country;
NSString *test = [NSString stringWithFormat:@"%@", stateName];
我试着把代码放如下:

NSString* urlString = @"http://maps.google.com/maps?saddr=%@+
%@&daddr=Birmingham+UK",statName,country;
NSString *test = [NSString stringWithFormat:@"%@", stateName];
NSString*urlString= @"http://maps.google.com/maps?saddr=%@+英国和daddr=伯明翰+英国”,测试

它不起作用


谢谢。

如果要在字符串中包含对象数据,则需要使用stringWithFormat。因此:

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


希望这有帮助。

您能正确仔细地粘贴代码吗?您所做的操作有一些语法错误。如何使用当前位置?在上面的文本框中。lowwer文本框我已经有了。