这是我与UIActivityVieController共享Google链接的代码:
if let myWebsite = NSURL(string: "http://maps.google.com/?q=<\(myLatitude)>,<\(myLongitude)>") {
let objectsToShare = [alertMessage, myWebsite]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
//New Excluded Activities Code
activityVC.excludedActivityTypes = [UIActivityTypeAirDrop, UIActivityTypeAddToReadingList]
self.presentViewController(activityVC, animated: true, completion: nil)
}但是,此链接无效;不调用if语句。我怎么才能解决这个问题?
发布于 2015-09-08 10:05:00
NSURL的格式应该如下所示:
let myWebsite = NSURL(string: "http://maps.google.com/?q=\(myLatitude),\(myLongitude)")若要在字符串中使用字符串,应编写
"My string \(otherString)";https://stackoverflow.com/questions/32454433
复制相似问题