2
Swift에서 내 코드에 작은 따옴표 문자를 추가하려했지만 계속해서 \ '을 (를) 추가하고 있으며 이는 API 호출에 필수적입니다.Swift의 작은 따옴표 문자
내 코드는 다음과 같습니다
$filter=geo.distance(Location, geography'POINT(lat, long)') le 0.5&searchMode=all&$count=true
날 감사를 알려 :
let locationLat = String(format: "%f", (currentLocation?.coordinate.latitude)!)
let locationLong = String(format: "%f", (currentLocation?.coordinate.longitude)!)
let apiLocation = "$filter=geo.distance(Location,geographyPoint" + "(" + locationLat + locationLong + ")) le 0.1"
내가 좋아하는 apiLocation 변수가 보이게해야합니다.
실제 견적은 어디에 있습니까? Btw는 float/double에서'toString '을 사용할 수 있습니다.'String (format :)'에 대한 필요가 없습니다. – Alexander
그리고'''를 이스케이프 할 필요는 없습니다. 단지 문자열 안에 입력하고 [interpolation] (https : //developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/StringsAndCharacters.html#//apple_ref/doc/uid/TP40014097-CH7-ID292)를 참조하십시오. – Moritz