{"id":18426159,"url":"https://github.com/clevertap/clevertap-geofence-ios","last_synced_at":"2025-04-07T16:32:24.784Z","repository":{"id":43520604,"uuid":"274609191","full_name":"CleverTap/clevertap-geofence-ios","owner":"CleverTap","description":"CleverTap iOS Geofence SDK","archived":false,"fork":false,"pushed_at":"2024-04-22T10:38:28.000Z","size":23127,"stargazers_count":7,"open_issues_count":2,"forks_count":3,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-23T09:40:10.863Z","etag":null,"topics":["clevertap-geofence","geofencing-capabilities"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CleverTap.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-24T07:53:34.000Z","updated_at":"2024-04-22T10:36:50.000Z","dependencies_parsed_at":"2024-11-06T05:17:22.670Z","dependency_job_id":null,"html_url":"https://github.com/CleverTap/clevertap-geofence-ios","commit_stats":{"total_commits":267,"total_committers":9,"mean_commits":"29.666666666666668","dds":"0.41947565543071164","last_synced_commit":"6ee7d59cf1b864be27929f11a358440ad6b6c81c"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverTap%2Fclevertap-geofence-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverTap%2Fclevertap-geofence-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverTap%2Fclevertap-geofence-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverTap%2Fclevertap-geofence-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CleverTap","download_url":"https://codeload.github.com/CleverTap/clevertap-geofence-ios/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247688103,"owners_count":20979606,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clevertap-geofence","geofencing-capabilities"],"created_at":"2024-11-06T05:07:04.837Z","updated_at":"2025-04-07T16:32:19.775Z","avatar_url":"https://github.com/CleverTap.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/CleverTap/clevertap-ios-sdk/blob/master/docs/images/clevertap-logo.png\" width=\"50%\"/\u003e\n\u003c/p\u003e\n\n[![Version](https://img.shields.io/cocoapods/v/CleverTapGeofence.svg?style=flat)](http://cocoapods.org/pods/CleverTapGeofence)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://mit-license.org)\n[![codebeat badge](https://codebeat.co/badges/72d5f95b-6d33-4811-97fb-7c7cff001815)](https://codebeat.co/projects/github-com-clevertap-clevertap-geofence-ios-master)\n[![Language](https://img.shields.io/badge/swift-5.1-orange.svg)](https://developer.apple.com/swift)\n[![Platform](http://img.shields.io/badge/platform-iOS-lightgrey.svg?style=flat)](https://developer.apple.com/resources/)\n![iOS 10.0+](https://img.shields.io/badge/iOS-10.0%2B-blue.svg)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg)](https://swift.org/package-manager/)\n\n## 👋 Introduction\n\nCleverTap Geofence SDK provides Geofencing capabilities to CleverTap iOS SDK by using the Core Location framework. This document lists down steps to utilize CleverTap Geofence in your apps. You can further customize your integration of CleverTap Geofence by using the [Geofence Customization document](Docs/Customization.md).\n\n## ⍗ Contents\n\n- [Requirements](#-requirements)\n- [Installation](#-installation)\n    - [Via CocoaPods](#via-cocoapods)\n    - [Via Swift Package Manager](#via-Swift Package Manager)   \n- [Integration](#-integration)\n- [Customization](#-customization)\n- [Example Usage](#-example-usage)\n- [Change Log](#-change-log)\n- [Help and Questions](#-help-and-questions)\n- [License](#-license)\n\n\n## 📋 Requirements\nFollowing are required for using CleverTap Geofence SDK -\n- [CleverTap iOS SDK version 3.9.0 or above](https://github.com/CleverTap/clevertap-ios-sdk/releases)\n- Swift version 5.1 or above\n- iOS version 10.0 or above\n- Xcode 12 for targeting iOS 14.x.x\n- CoreLocation iOS Framework\n\n## 🎉 Installation\n\n#### Via CocoaPods\n\n[CocoaPods](https://cocoapods.org) is a dependency manager for iOS projects. To integrate CleverTap Geofence SDK into your Xcode project using CocoaPods, specify the following in your `Podfile`:\n\n```\npod 'CleverTap-Geofence-SDK'\npod 'CleverTap-iOS-SDK', :git =\u003e 'https://github.com/CleverTap/clevertap-ios-sdk.git'\n```\n\nYou can refer to [Demo Applications](https://github.com/CleverTap/clevertap-geofence-ios/tree/master/Examples/CocoapodsExample) showcasing CocoaPods Installation.\n\n#### Via Swift Package Manager\n\nSwift Package Manager is an Xcode tool that installs project dependencies. To use it to install CleverTap Geofence SDK, follow these steps:\n\n- In Xcode, navigate to **File -\u003e Swift Package Manager -\u003e Add Package Dependency.**\n- Enter **https://github.com/CleverTap/clevertap-geofence-ios.git** when choosing package repo and Click **Next.**\n- On the next screen, Select an SDK version (by default, Xcode selects the latest stable version). Click **Next.**\n- Click **Finish** and ensure that the **CleverTap-Geofence-SDK** has been added to the appropriate target.\n\nYou can refer to [Demo Applications](https://github.com/CleverTap/clevertap-geofence-ios/tree/master/Examples/SPMSample) showcasing SPM Installation.\n\nFor installing CleverTap Geofence via [Carthage](Docs/Customization.md#carthage) or [Manually](Docs/Customization.md#manual), check out the steps in [Geofence Customization document](Docs/Customization.md#alternative-installation).\n\n## 🚀 Integration\n\nCleverTap Geofence utilizes Core Location APIs to setup up Geofences Region monitoring.\n The CleverTap Geofence will **NOT** request Location permissions from the user. Location Permission has to requested by the app as deemed fit while onboarding the user to the app.\n\n**1.** In Xcode, enable `Location Updates` in `Background Modes` for your App Target. You can enable this in Xcode by -\n  - Click on your `AppTarget` in Xcode Project Navigator\n  - Click on `Signing \u0026 Capabilities` tab \n  - Click on `+ Capability` button\n  - Select the `Background Modes` option\n  - Enable `Location Updates` by selecting the checkbox\n  \n  ![Xcode Capabilities](Docs/Capabilities.png  \"Capabilities\")\n  \n**2.** In your `Info.plist` file, add the following keys -\n  - `NSLocationAlwaysAndWhenInUseUsageDescription` also known as `Privacy - Location Always and When In Use Usage Description`\n   This is a key that accepts a String description to be used by iOS while requesting Location permission from the user.\n\n  - `NSLocationWhenInUseUsageDescription` also known as `Privacy - Location When In Use Usage Description`\n  This is a key that accepts a String description to be used by iOS while requesting Location permission from the user.\n\n  - `UIBackgroundModes` also known as `Required background modes`\n  This is a key that accepts an Array of items. This should include the `location` also known as `App registers for location updates` item to enable Background Location monitoring.\n\n  *For iOS 11 only*: If your app targets iOS 11 then along with the above mentioned 3 Info.plist keys, the following key is also required. If your app target is iOS 12 or above, the following is not required -\n  - `NSLocationAlwaysUsageDescription` also know as `Privacy - Location Always Usage Description`\n  This is a key that accepts a String description to be used by iOS while requesting Location permission from the user. Only required for iOS 11.\n\n\n  Following is an example of all the Info.plist keys in Source Code format -\n\n  ```\n  \u003ckey\u003eNSLocationAlwaysAndWhenInUseUsageDescription\u003c/key\u003e\n  \u003cstring\u003eApp needs your location to provide enhanced features.\u003c/string\u003e\n  \u003ckey\u003eNSLocationWhenInUseUsageDescription\u003c/key\u003e\n  \u003cstring\u003eApp needs your location to provide enhanced features.\u003c/string\u003e\n  \u003ckey\u003eNSLocationAlwaysUsageDescription\u003c/key\u003e\n  \u003cstring\u003eApp needs your location to provide enhanced features.\u003c/string\u003e\n  \u003ckey\u003eUIBackgroundModes\u003c/key\u003e\n  \u003carray\u003e\n    \u003cstring\u003elocation\u003c/string\u003e\n    \u003cstring\u003eremote-notification\u003c/string\u003e\n    \u003cstring\u003efetch\u003c/string\u003e\n    \u003cstring\u003eprocessing\u003c/string\u003e\n  \u003c/array\u003e\n  ```\n  \n  ![Xcode Info.plist](Docs/Info-plist.png \"Info.plist\")\n\n\n\n**3.** In your `AppDelegate` file, import the CleverTapGeofence module:\n\n  ```\n  // Swift\n  import CleverTapGeofence\n\n  // Objective-C\n  @import CleverTapGeofence;\n  ```\n  \n**4.** In your AppDelegate's `application:didFinishLaunchingWithOptions:` function, add the following the code snippet. \nEnsure that Geofence SDK initialization is done after CleverTap Main SDK initialization.\n\n  ```\n  // Swift\n  CleverTapGeofence.monitor.start(didFinishLaunchingWithOptions: launchOptions)\n\n  // Objective-C\n  [[CleverTapGeofence monitor] startWithDidFinishLaunchingWithOptions:launchOptions];\n  ```\n \n**5.** CleverTap Geofence SDK requires location permission from users to provide the Geofencing capabilities. The App is expected to request Location permission from the user at an appropriate time. Once CleverTap Geofence SDK detects that Location permission has been given by the user, only then the module will start to perform its functions.\n\n*iOS 14 Update:* If user has opted for `reducedAccuracy` option of the `accuracyAuthorization` settings then CleverTap Geofence will not work as expected since the app cannot reliably utilize Core Location's Region Monitoring APIs.\n\n  An example of how an app can request location permission is below:\n\n  ```\n  // Swift\n  let locationManager = CLLocationManager()\n  locationManager.requestAlwaysAuthorization()\n\n  // Objective-C \n  CLLocationManager *locationManager = [[CLLocationManager alloc] init];\n  [locationManager requestAlwaysAuthorization];\n  ```\n\n\n![Xcode Start Geofence Snippet](Docs/StartGeofence.png  \"Example AppDelegate.swift\")\n\n## 📖 Customization\nYou can further *customize* your integration of CleverTap Geofence by following the [Customization document](Docs/Customization.md).\n\n## 𝌡 Example Usage\n\n- A [demo application](https://github.com/CleverTap/clevertap-geofence-ios/tree/master/Examples/CocoapodsExample) showing CocoaPods Installation.\n- A [demo application](https://github.com/CleverTap/clevertap-geofence-ios/tree/master/Examples/CarthageExample) showing Carthage Installation.\n- A [demo application](https://github.com/CleverTap/clevertap-geofence-ios/tree/master/Examples/Manual) showing Manual Installation.\n- A [demo application](https://github.com/CleverTap/clevertap-geofence-ios/tree/master/Examples/SPMSample) showing SPM Installation.\n\n## 🆕 Change Log\n\nRefer to the [CleverTap Geofence SDK Change Log](https://github.com/CleverTap/clevertap-geofence-ios/blob/master/CHANGELOG.md).\n\n\n## 🤝 Help and Questions\n\nIf you have questions or concerns, you can reach out to the CleverTap Support Team from your CleverTap Dashboard.\n\n## 📄 License\nCleverTap Geofence is MIT licensed, as found in the [LICENSE](https://github.com/CleverTap/clevertap-geofence-ios/blob/master/LICENSE) file.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclevertap%2Fclevertap-geofence-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclevertap%2Fclevertap-geofence-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclevertap%2Fclevertap-geofence-ios/lists"}