{"id":19491633,"url":"https://github.com/rudderlabs/rudder-interceptors-ios","last_synced_at":"2026-05-12T13:41:55.540Z","repository":{"id":65779706,"uuid":"591577593","full_name":"rudderlabs/rudder-interceptors-ios","owner":"rudderlabs","description":"Consent interceptor for the RudderStack iOS SDK","archived":false,"fork":false,"pushed_at":"2026-01-29T20:33:17.000Z","size":98,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-01-29T21:35:25.986Z","etag":null,"topics":["ios","rudderstack"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/rudderlabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-01-21T06:29:54.000Z","updated_at":"2025-11-07T12:30:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"f969b5d3-3254-47fe-9eef-5dbd29d63c0b","html_url":"https://github.com/rudderlabs/rudder-interceptors-ios","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/rudderlabs/rudder-interceptors-ios","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudderlabs%2Frudder-interceptors-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudderlabs%2Frudder-interceptors-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudderlabs%2Frudder-interceptors-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudderlabs%2Frudder-interceptors-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rudderlabs","download_url":"https://codeload.github.com/rudderlabs/rudder-interceptors-ios/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rudderlabs%2Frudder-interceptors-ios/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32942140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T09:19:52.626Z","status":"ssl_error","status_checked_at":"2026-05-12T09:17:33.438Z","response_time":102,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ios","rudderstack"],"created_at":"2024-11-10T21:17:32.649Z","updated_at":"2026-05-12T13:41:55.535Z","avatar_url":"https://github.com/rudderlabs.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://rudderstack.com/\"\u003e\n    \u003cimg src=\"https://user-images.githubusercontent.com/59817155/121357083-1c571300-c94f-11eb-8cc7-ce6df13855c9.png\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cb\u003eThe Customer Data Platform for Developers\u003c/b\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003e\n    \u003ca href=\"https://rudderstack.com\"\u003eWebsite\u003c/a\u003e\n    ·\n    \u003ca href=\"https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-ios-sdk/\"\u003eDocumentation\u003c/a\u003e\n    ·\n    \u003ca href=\"https://rudderstack.com/join-rudderstack-slack-community\"\u003eCommunity Slack\u003c/a\u003e\n  \u003c/b\u003e\n\u003c/p\u003e\n\n---\n\n# Consent Management for RudderStack iOS SDK\n\n| The RudderOneTrust iOS SDK supports OneTrust consent management from Rudder version 1.10.0. |\n| :----|\n\nThe [RudderStack iOS SDK](https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-ios-sdk/) lets you specify the user's consent during initialization. This readme lists the necessary steps to develop a consent interceptor for the iOS SDK and use it to initialize the SDK once the user gives their consent.\n\n## Developing a consent interceptor\n\n### Objective C\n\n1. Create a `CustomConsentFilter.h` file by extending `RSConsentFilter`, as shown:\n\n```objectivec\n#import \u003cFoundation/Foundation.h\u003e\n#import \u003cRudder/Rudder.h\u003e\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface CustomConsentFilter : NSObject\u003cRSConsentFilter\u003e\n\n@end\n\nNS_ASSUME_NONNULL_END\n```\n\n2. Create a `CustomConsentFilter.m` file, as shown:\n\n```objectivec\n#import \"CustomConsentFilter.h\"\n\n@implementation CustomConsentFilter\n\n- (NSDictionary \u003cNSString *, NSNumber *\u003e * __nullable)filterConsentedDestinations:(NSArray \u003cRSServerDestination *\u003e *)destinations {\n    NSDictionary \u003cNSString *, NSNumber *\u003e *filteredConsentedDestinations;\n    // Do someting\n    return filteredConsentedDestinations;\n}\n\n@end\n```\n\n### Swift\n\n1. Create a `CustomConsentFilter` file by extending `RSConsentFilter`, as shown:\n\n```swift\n@objc\nopen class OneTrustInterceptor: NSObject, RSConsentFilter {\n    @objc\n    public override init() {\n        super.init()\n    }\n\n    public func filterConsentedDestinations(_ destinations: [RSServerDestination]) -\u003e [String: NSNumber]? {\n        let filteredConsentedDestinations: [String: NSNumber]\n        // Do something\n        return filteredConsentedDestinations\n    }\n}\n```\n\n## Registering interceptor with iOS SDK\n\nYou can register `CustomConsentFilter` with the iOS SDK during the initialization, as shown:\n\n### Objective C\n\n```objectivec\nRSConfigBuilder *builder = [[RSConfigBuilder alloc] init];\n[builder withLoglevel:RSLogLevelDebug];\n[builder withDataPlaneUrl:DATA_PLANE_URL];\n[builder withConsentFilter:[[CustomConsentFilter alloc] init]];\n\n[RSClient getInstance:WRITE_KEY config:builder.build];\n```\n\n### Swift\n\n```swift\nlet builder: RSConfigBuilder = RSConfigBuilder()\n    .withLoglevel(RSLogLevelDebug)\n    .withDataPlaneUrl(DATA_PLANE_URL)\n    .withConsentFilter(CustomConsentFilter())\n\nRSClient.getInstance(rudderConfig.WRITE_KEY, config: builder.build())\n```\n\n## Installing OneTrust consent\n\n1. Install `RudderOneTrustConsentFilter` by adding the following line to your `Podfile`:\n\n```ruby\npod 'RudderOneTrustConsentFilter', '~\u003e 1.1.0'\n```\n\n2. Import the SDK, as shown:\n\n#### Objective C\n\n```objectivec\n@import RudderOneTrustConsentFilter;\n```\n\n#### Swift\n\n```swift\nimport RudderOneTrustConsentFilter\n```\n\n3. Finally, add the imports to your `AppDelegate` file under the `didFinishLaunchingWithOptions` method:\n\n#### Objective C\n\n```objectivec\n@interface AppDelegate ()\u003cOTEventListener\u003e\n\n@end\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n    [[OTPublishersHeadlessSDK shared] startSDKWithStorageLocation:STORAGE_LOCATION domainIdentifier:DOMAIN_IDENTIFIER languageCode:@\"en\" params:nil loadOffline:NO completionHandler:^(OTResponse *response) {\n        if (response.status) {\n        \n        }\n    }];\n    \n    [[OTPublishersHeadlessSDK shared] addEventListener:self];\n}\n\n- (void)initializeRudderSDK {\n    RSConfigBuilder *builder = [[RSConfigBuilder alloc] init];\n    [builder withLoglevel:RSLogLevelDebug];\n    [builder withDataPlaneUrl:DATA_PLANE_URL];\n    [builder withConsentFilter:[[RudderOneTrustConsentFilter alloc] init]];\n\n    [RSClient getInstance:rudderConfig.WRITE_KEY config:builder.build];\n}\n\n- (void)onPreferenceCenterConfirmChoices {\n    [self initializeRudderSDK];\n}\n```\n\n#### Swift\n\n```swift\nclass AppDelegate {\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n        OTPublishersHeadlessSDK.shared.startSDK(\n            storageLocation: STORAGE_LOCATION,\n            domainIdentifier: DOMAIN_IDENTIFIER,\n            languageCode: \"en\"\n        ) { response in\n            if response.status {\n        \n            }\n        }\n        \n        OTPublishersHeadlessSDK.shared.addEventListener(self)\n    }\n    \n    func initializeRudderSDK() {\n        let builder: RSConfigBuilder = RSConfigBuilder()\n            .withLoglevel(RSLogLevelDebug)\n            .withDataPlaneUrl(DATA_PLANE_URL)\n            .withConsentFilter(RudderOneTrustConsentFilter())\n\n        RSClient.getInstance(rudderConfig.WRITE_KEY, config: builder.build())\n    }\n}\n\nextension AppDelegate: OTEventListener {\n    func onPreferenceCenterConfirmChoices() {\n        initializeRudderSDK()\n    }\n}\n```\n\n| Important: It is recommended to load the SDK only if the user provides their consent. |\n| :----|\n\n## License\n\nThis feature is released under the [**MIT License**](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frudderlabs%2Frudder-interceptors-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frudderlabs%2Frudder-interceptors-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frudderlabs%2Frudder-interceptors-ios/lists"}