Bu ürün veya özellik eski durumdadır. Eski durum hakkında daha fazla bilgi için Eski ürünler ve özellikler başlıklı makaleyi inceleyin. iOS için Yerler API'ye(yeni) geçmek istiyorsanız Taşıma rehberi'ne bakın.
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
iOS için Yerler SDK'sını kullanarak cihazın şu anda bulunduğu yeri keşfedebilirsiniz. Yani cihazın şu anda bildirdiği konumdaki yer. Yerlere örnek olarak yerel işletmeler, ilgi çekici yerler ve coğrafi konumlar verilebilir.
Döndürülecek veri türlerini belirten bir veya daha fazla GMSPlaceField. Bu parametreyi atlarsanız mümkün olan TÜM alanlar döndürülür ve buna göre faturalandırılırsınız. Bu yalnızca Yer Ayrıntıları istekleri için geçerlidir.
Sonuçları işleyen bir geri çağırma yöntemi.
.
Alanlar yer arama sonuçlarına karşılık gelir ve üç faturalandırma kategorisine ayrılmıştır: Temel, Kişi ve Atmosfer. Temel alanlar taban fiyat üzerinden faturalandırılır ve ek ücret alınmaz. Kişi ve Atmosfer alanları daha yüksek bir ücretle faturalandırılır. Yer verileri isteklerinin nasıl faturalandırıldığı hakkında daha fazla bilgi için Kullanım ve Faturalandırma başlıklı makaleyi inceleyin.
API, belirtilen geri çağırma yöntemini çağırarak bir GMSPlaceLikelihood nesnesi dizisi döndürür.
Her GMSPlaceLikelihood
nesnesi bir yeri temsil eder. Sonuçta her bir yer için, doğru yer olma olasılığı belirtilir. Daha yüksek bir değer, yerin en iyi eşleşme olma olasılığının daha yüksek olduğunu gösterir. Cihaz konumuna karşılık gelen bilinen bir yer yoksa arabellek boş olabilir.
Aşağıdaki kod örneği, cihazın bulunduğu en olası yerlerin listesini alır ve her yerin adını ve olasılığını günlüğe kaydeder.
Swift
// Specify the place data types to return.letfields:GMSPlaceField=GMSPlaceField(rawValue:UInt(GMSPlaceField.name.rawValue)|UInt(GMSPlaceField.placeID.rawValue))!placesClient?.findPlaceLikelihoodsFromCurrentLocation(withPlaceFields:fields,callback:{(placeLikelihoodList:Array<GMSPlaceLikelihood>?,error:Error?)inifleterror=error{print("An error occurred: \(error.localizedDescription)")return}ifletplaceLikelihoodList=placeLikelihoodList{forlikelihoodinplaceLikelihoodList{letplace=likelihood.placeprint("Current Place name \(String(describing:place.name)) at likelihood \(likelihood.likelihood)")print("Current PlaceID \(String(describing:place.placeID))")}}})
Objective-C
// Specify the place data types to return.GMSPlaceFieldfields=(GMSPlaceFieldName|GMSPlaceFieldPlaceID);[_placesClientfindPlaceLikelihoodsFromCurrentLocationWithPlaceFields:fieldscallback:^(NSArray<GMSPlaceLikelihood*>*_Nullablelikelihoods,NSError*_Nullableerror){if(error!=nil){NSLog(@"An error occurred %@",[errorlocalizedDescription]);return;}if(likelihoods!=nil){for(GMSPlaceLikelihood*likelihoodinlikelihoods){GMSPlace*place=likelihood.place;NSLog(@"Current place name: %@",place.name);NSLog(@"Place ID: %@",place.placeID);}}}];
Olasılık değerleriyle ilgili notlar:
Olasılık, tek bir istek için döndürülen yerler listesinde yer alan en iyi eşleşme olma olasılığını gösterir. Farklı isteklerdeki olasılıkları karşılaştıramazsınız.
Olasılık değeri 0 ile 1,0 arasında olacaktır.
Döndürülen GMSPlaceLikelihood obje dizisindeki olasılıkların toplamı her zaman 1,0'dan az veya 1,0'a eşittir. Toplam değerin 1,0 olmayabileceğini unutmayın.
Örneğin, doğru yerin A Yeri olma olasılığının% 55, B Yeri olma olasılığının ise% 35 olduğunu göstermek için olasılık dizisinin iki üyesi vardır: olasılığı 0,55 olan A Yeri ve olasılığı 0,35 olan B Yeri.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-08-31 UTC."],[],[],null,["# Current Place\n\nUsing the Places SDK for iOS, you can discover the place where the\ndevice is currently located. That is, the place at the device's\ncurrently-reported location. Examples of places include local businesses,\npoints of interest, and geographic locations.\n\n1. [Request location authorization](#permissions)\n2. [Usage limits](#quota)\n3. [Get the current location](#get-current)\n4. [Display attributions in your app](#attributions)\n\nRequesting location authorization\n---------------------------------\n\nIf your app uses\n[`GMSPlacesClient findPlaceLikelihoodsFromCurrentLocationWithPlaceFields:`](/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#-findplacelikelihoodsfromcurrentlocationwithplacefields:callback:),\nyour app must request permission to use location services. Add the\n`NSLocationWhenInUseUsageDescription` key to your `Info.plist`\nfile, to define the string informing the user why you need the location\nservices. For example: \n\n```text\n\u003ckey\u003eNSLocationWhenInUseUsageDescription\u003c/key\u003e\n\u003cstring\u003eShow your location on the map\u003c/string\u003e\n```\n\nIf you want to call\n[`findPlaceLikelihoodsFromCurrentLocationWithPlaceFields:`](/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#-findplacelikelihoodsfromcurrentlocationwithplacefields:callback:) when\nthe app is in the background, without triggering a confirmation dialog, take\nthe following steps prior to making the call:\n\n1. Add the `NSLocationAlwaysUsageDescription` key to your `Info.plist`file.\n2. Call `requestAlwaysAuthorization` on any instance of `CLLocationManager` before calling the method.\n\nRequest authorization from `CLLocationManager` as follows: \n\n### Swift\n\n```swift\n locationManager.requestAlwaysAuthorization()\n \n```\n\n### Objective-C\n\n```objective-c\n [self.locationManager requestAlwaysAuthorization];\n \n```\n\nGetting the current location\n----------------------------\n\n| **Note:** iOS 14 introduced a new privacy feature where users can choose to share their approximate, rather than precise, location. Check your app's value of [accuracyAuthorization](https://developer.apple.com/documentation/corelocation/cllocationmanager/3600215-accuracyauthorization) in `CLLocationManager` so your app behaves appropriately. [See this video for more information.](https://developer.apple.com/videos/play/wwdc2020/10162/)\n\nTo find the local business or other place where the device is currently\nlocated, call\n[`GMSPlacesClient\nfindPlaceLikelihoodsFromCurrentLocationWithPlaceFields:`](/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#-findplacelikelihoodsfromcurrentlocationwithplacefields:callback:). Include\nthe following parameters:\n\n- One or more `GMSPlaceField`s, specifying which data types to return. If you omit this parameter, ALL possible fields will be returned, and you will be billed accordingly. This applies only to Place Details requests.\n- A callback method to handle the results.\n\n| **IMPORTANT!** `findPlaceLikelihoodsFromCurrentLocationWithPlaceFields:` does not support the following fields: `GMSPlaceFieldAddressComponents`, `GMSPlaceFieldOpeningHours`, `GMSPlaceFieldPhoneNumber`, and `GMSPlaceFieldWebsite`. Read more about [place data fields](/maps/documentation/places/ios-sdk/place-data-fields)\n\nFields correspond to Place Search results, and are divided into three billing categories:\nBasic, Contact, and Atmosphere. Basic fields are billed at base rate, and incur no additional\ncharges. Contact and Atmosphere fields are billed at a higher rate. For more information\nabout how Place data requests are billed, see\n[Usage and Billing](/maps/documentation/places/ios-sdk/usage-and-billing).\n\nThe API invokes the specified callback method, returning an array of\n[`GMSPlaceLikelihood`](/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceLikelihood)\nobjects.\n\nEach\n[`GMSPlaceLikelihood`](/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceLikelihood)\nobject represents a place. For each place, the result includes an\nindication of the likelihood that the place is the right one. A higher value\nmeans a greater probability that the place is the best match. The buffer may\nbe empty, if there is no known place corresponding to the device location.\n\nThe following code sample retrieves the list of places where the device is\nmost likely to be located, and logs the name and likelihood for each place. \n\n### Swift\n\n```swift\n// Specify the place data types to return.\nlet fields: GMSPlaceField = GMSPlaceField(rawValue: UInt(GMSPlaceField.name.rawValue) |\n UInt(GMSPlaceField.placeID.rawValue))!\nplacesClient?.findPlaceLikelihoodsFromCurrentLocation(withPlaceFields: fields, callback: {\n (placeLikelihoodList: Array\u003cGMSPlaceLikelihood\u003e?, error: Error?) in\n if let error = error {\n print(\"An error occurred: \\(error.localizedDescription)\")\n return\n }\n\n if let placeLikelihoodList = placeLikelihoodList {\n for likelihood in placeLikelihoodList {\n let place = likelihood.place\n print(\"Current Place name \\(String(describing: place.name)) at likelihood \\(likelihood.likelihood)\")\n print(\"Current PlaceID \\(String(describing: place.placeID))\")\n }\n }\n})\n```\n\n### Objective-C\n\n```objective-c\n// Specify the place data types to return.\nGMSPlaceField fields = (GMSPlaceFieldName | GMSPlaceFieldPlaceID);\n[_placesClient findPlaceLikelihoodsFromCurrentLocationWithPlaceFields:fields callback:^(NSArray\u003cGMSPlaceLikelihood *\u003e * _Nullable likelihoods, NSError * _Nullable error) {\n if (error != nil) {\n NSLog(@\"An error occurred %@\", [error localizedDescription]);\n return;\n }\n if (likelihoods != nil) {\n for (GMSPlaceLikelihood *likelihood in likelihoods) {\n GMSPlace *place = likelihood.place;\n NSLog(@\"Current place name: %@\", place.name);\n NSLog(@\"Place ID: %@\", place.placeID);\n }\n }\n}];\n```\n\nNotes about the likelihood values:\n\n- The likelihood provides a relative probability of the place being the best match within the list of returned places for a single request. You can't compare likelihoods across different requests.\n- The value of the likelihood will be between 0 and 1.0.\n- The sum of the likelihoods in a returned array of [`GMSPlaceLikelihood`](/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceLikelihood) objects is always less than or equal to 1.0. Note that the sum isn't necessarily 1.0.\n\nFor example, to represent a 55% likelihood that the correct place is Place A,\nand a 35% likelihood that it's Place B, the likelihood array has two members:\nPlace A with a likelihood of 0.55 and\nPlace B with a likelihood of 0.35.\n\nDisplaying attributions in your app\n-----------------------------------\n\nWhen your app displays information obtained from\n[`GMSPlacesClient\nfindPlaceLikelihoodsFromCurrentLocationWithPlaceFields:`](/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#-findplacelikelihoodsfromcurrentlocationwithplacefields:callback:), the app\nmust also display attributions. Read more about\n[attributions](/maps/documentation/places/ios-sdk/attributions)."]]