Objective c 如何从iOS应用程序发送电子邮件地址链接,然后在谷歌地图中搜索
我正在尝试从iOS应用程序向电子邮件收件人发送地址。我想把这个地址链接到Safari/browser中的谷歌地图搜索 这是我到目前为止所拥有的。我想知道如何使用地址在地图中搜索:Objective c 如何从iOS应用程序发送电子邮件地址链接,然后在谷歌地图中搜索,objective-c,ios,google-maps,Objective C,Ios,Google Maps,我正在尝试从iOS应用程序向电子邮件收件人发送地址。我想把这个地址链接到Safari/browser中的谷歌地图搜索 这是我到目前为止所拥有的。我想知道如何使用地址在地图中搜索: NSString *myUrl = [NSString stringWithFormat:@"https://maps.google.co.uk/%@", addressLb.text]; NSString *emailBody = [NSString stringWithFormat:@"I'm at %@ on
NSString *myUrl = [NSString stringWithFormat:@"https://maps.google.co.uk/%@", addressLb.text];
NSString *emailBody = [NSString stringWithFormat:@"I'm at %@ on %@. Come join me... %@", nameLb.text, addressLb.text, myUrl];
我遇到的一个问题是addressLB.text中的地址有空格。所以,NSString*myUrl=[nsstringwithformat:@“maps.google.co.uk/?q=%@”,addressLb.text]
将搜索maps.google.co.uk/?q=1600并删除
感谢您提供的任何帮助添加/maps?q=并在谷歌地图url的末尾使用加号(+)替换空格。例如,要查找华盛顿特区宾夕法尼亚大道1600号:
谢谢。我遇到的一个问题是addressLB.text中的地址有空格。因此,NSString*myUrl=[nsstringstringwithformat:@',addressLb.text];将搜索并删除Pennsylvania只需将空格替换为+[addressLb.text StringByRepllacingOccurrencesofString:@''和字符串:@“+”];使用
stringByReplacingOccurrencesOfString:with字符串:
将所有空格更改为+。例如,`NSString*Whitehouse AddressWithspaces=@“华盛顿特区宾夕法尼亚大道1600号”;NSString*Whitehouse AddressWithplus=[Whitehouse AddressWithspaces StringByReplacingOfString:@“withString:@”+”]`