Memulai
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara menyiapkan SDK iOS. Jika Anda belum menyelesaikan prasyarat, selesaikan terlebih dahulu.
Dependensi
Swift Package Manager
Di Xcode, instal Paket Swift Google-SearchInApps-SDK dengan membuka File > Add Packages....
Pada perintah yang muncul, telusuri repositori GitHub Paket Swift Google-SearchInApps-SDK:
https://github.com/google/search-in-apps.git
- Pilih versi Paket Swift Google-SearchInApps-SDK yang ingin Anda
gunakan. Untuk project baru, sebaiknya gunakan Versi Utama Berikutnya
Setelah selesai, Xcode akan mulai menyelesaikan dependensi paket Anda dan mendownloadnya di latar belakang. Untuk mengetahui detail selengkapnya tentang cara menambahkan dependensi paket, lihat artikel Apple.
CocoaPods
Impor Google-SearchInApps-SDK ke dalam project iOS menggunakan
CocoaPods. Buka Podfile project Anda dan tambahkan baris ini ke target aplikasi Anda:
pod 'Google-SearchInApps-SDK'
Kemudian dari command line, jalankan:
pod install --repo-update
Jika Anda baru menggunakan CocoaPods, lihat dokumentasi resminya untuk mengetahui info cara membuat dan menggunakan Podfile.
Mengupdate Info.plist Anda
Perbarui file Info.plist
aplikasi Anda untuk menambahkan dua kunci:
- Kunci
GSAAPIKey
dengan nilai string kunci API SDK Anda (lihat di atas).
- Kunci
GSAClientIdentifier
dengan nilai string ID klien aplikasi Anda (lihat di atas).
Sampel Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>GSAAPIKey</key>
<string>ABC123...xyz890</string>
<key>GSAClientIdentifier</key>
<string>ms-demo-app-sia</string>
...
</dict>
</plist>
Init
Membuat instance
ContextualSearchRuntime
Objective-C
ContextualSearchRuntime
ContextualSearchRuntime *searchRuntime = [[ContextualSearchRuntime alloc] init];
Berikutnya: Fitur penelusuranarrow_forward
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-25 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-25 UTC."],[[["This guide explains how to integrate the iOS SDK for Google Search in Apps, covering setup, dependency management, and initialization."],["Before starting, ensure you have fulfilled the prerequisites mentioned in the linked documentation."],["You can add the SDK to your project using either Swift Package Manager or CocoaPods, with instructions provided for both methods."],["Remember to update your app's `Info.plist` file with your API key and client identifier for the SDK to function correctly."],["Finally, initialize the `ContextualSearchRuntime` to begin utilizing the search functionalities."]]],["To set up the iOS SDK, first install the Google-SearchInApps-SDK via Swift Package Manager or CocoaPods. For Swift Package Manager, add the package via Xcode using the provided GitHub repository URL. For CocoaPods, add `pod 'Google-SearchInApps-SDK'` to your Podfile and run `pod install --repo-update`. Then, update your app's `Info.plist` by adding `GSAAPIKey` and `GSAClientIdentifier`. Finally, initialize a `ContextualSearchRuntime` instance in either Swift or Objective-C.\n"]]