{"id":18937386,"url":"https://github.com/fetch/awspushmanager","last_synced_at":"2025-04-15T18:31:58.039Z","repository":{"id":56901305,"uuid":"50833966","full_name":"fetch/AWSPushManager","owner":"fetch","description":"AWS SNS Push registration manager","archived":false,"fork":false,"pushed_at":"2017-04-16T09:55:06.000Z","size":15,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T18:16:59.508Z","etag":null,"topics":[],"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/fetch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-01T11:02:54.000Z","updated_at":"2020-02-06T13:50:45.000Z","dependencies_parsed_at":"2022-08-20T18:10:11.048Z","dependency_job_id":null,"html_url":"https://github.com/fetch/AWSPushManager","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetch%2FAWSPushManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetch%2FAWSPushManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetch%2FAWSPushManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetch%2FAWSPushManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fetch","download_url":"https://codeload.github.com/fetch/AWSPushManager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249129218,"owners_count":21217305,"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":[],"created_at":"2024-11-08T12:11:00.812Z","updated_at":"2025-04-15T18:31:53.028Z","avatar_url":"https://github.com/fetch.png","language":"Objective-C","readme":"⚠️ **Please note:** AWS now officially distributes AWSPushManager as part of their [Mobile Hub helper](https://github.com/aws/aws-mobilehub-helper-ios). Unfortunately this library is [not on CocoaPods](https://github.com/aws/aws-mobilehub-helper-ios/issues/7) yet.\n\n# AWSPushManager\n\nAWS SNS Push registration manager\n\nThe code of this library was extracted from the mobile hub example application.\n\nIt works with both Objective-C and Swift.\n\n## Dependencies\n\nDirect dependencies are the `AWSCore` and `AWSSNS` frameworks.\n\nTo actually be able to communicate with AWS the `AWSCognito` framework is required as well.\n\n## Installation\n\n### Using CocoaPods\n\nThis is the easiest, because it also installs the required dependencies.\n\nAdd `AWSPushManager` to the `Podfile`.\n\n```\npod 'AWSPushManager', '~\u003e 1.0.0'\n```\n\n### Manual installation\n\nCopy `AWSPushManager.h` and `AWSPushManager.m` to your project, and make sure to add the `AWSCore` and `AWSSNS` frameworks.\n\n## Initialization\n\n**Objective-C**\n\nImport the headers:\n\n```objc\n#import \u003cAWSPushManager/AWSPushManager.h\u003e\n```\n\nAnd update `AppDelegate.m` to match with the following:\n\n```objc\n- (BOOL)didFinishLaunching:(UIApplication *)application\n              withOptions:(NSDictionary *)launchOptions {\n\n    NSString *platformARN = @\"arn:aws:sns:us-east-1:123456789:app/APNS_SANDBOX/SomeAppName\";\n    AWSPushManager.defaultPlatformARN = platformARN;\n\n    return [[AWSPushManager defaultPushManager] interceptApplication:application\n                                       didFinishLaunchingWithOptions:launchOptions];\n}\n\n- (void)application:(UIApplication *)application\n                          didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {\n    [[AWSPushManager defaultPushManager] interceptApplication:application\n             didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];\n}\n\n- (void)application:(UIApplication *)application\n                          didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {\n    [[AWSPushManager defaultPushManager] interceptApplication:application\n             didFailToRegisterForRemoteNotificationsWithError:error];\n}\n\n- (void)application:(UIApplication *)application\n                          didReceiveRemoteNotification:(NSDictionary *)userInfo {\n    [[AWSPushManager defaultPushManager] interceptApplication:application\n                                 didReceiveRemoteNotification:userInfo];\n}\n```\n\n-----\n\n**Swift**\n\nImport the framework:\n\n```swift\nimport AWSPushManager\n```\n\nOr if not using frameworks import the headers in your `App-Bridging-Header.h`.\n\n```objc\n#import \u003cAWSPushManager/AWSPushManager.h\u003e\n```\n\nAnd update `AppDelegate.swift` to match with the following:\n\n```swift\nfunc application(application: UIApplication,\n                didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -\u003e Bool {\n\n    let platformARN = \"arn:aws:sns:us-east-1:123456789:app/APNS_SANDBOX/SomeAppName\"\n    AWSPushManager.setDefaultPlatformARN(platformARN)\n\n    return AWSPushManager.defaultPushManager().interceptApplication(application,\n                didFinishLaunchingWithOptions: launchOptions)\n}\n\nfunc application(application: UIApplication,\n                didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {\n    AWSPushManager.defaultPushManager().interceptApplication(application,\n                didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\n}\n\nfunc application(application: UIApplication,\n                didFailToRegisterForRemoteNotificationsWithError error: NSError) {\n    AWSPushManager.defaultPushManager().interceptApplication(application,\n                didFailToRegisterForRemoteNotificationsWithError: error)\n}\n\nfunc application(application: UIApplication,\n                didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {\n    AWSPushManager.defaultPushManager().interceptApplication(application,\n                didReceiveRemoteNotification: userInfo)\n}\n\n```\n\n## Usage\n\n### Minimal configuration\n\nTo start receiving notifications, you have to subscribe to one or more topics.\n\n**Objective-C**\n\n```objc\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    AWSPushManager *pushManager = [AWSPushManager defaultPushManager];\n    [pushManager registerForPushNotifications];\n    NSString *topicARN = @\"arn:aws:sns:us-east-1:123456789:SomeApp_alldevices\";\n    [pushManager registerTopicARNs:@[topicARN, ]];\n}\n```\n\n----\n\n**Swift**\n\n```swift\noverride func viewDidLoad() {\n    super.viewDidLoad()\n    let pushManager = AWSPushManager.defaultPushManager()\n    pushManager.registerForPushNotifications()\n    let topicARN = \"arn:aws:sns:us-east-1:123456789:SomeApp_alldevices\"\n    pushManager.registerTopicARNs([topicARN])\n}\n```\n\n\nTo respond to notifications anywhere in your application, you can use `AWSPushManager`'s delegate:\n\n**Objective-C**\n\n```objc\n- (void)pushManager:(AWSPushManager *)pushManager\n        didReceivePushNotification:(NSDictionary *)userInfo;\n```\n\n**Swift**\n\n```swift\nfunc pushManager(pushManager: AWSPushManager!,\n        didReceivePushNotification userInfo: [NSObject : AnyObject]!)\n```\n\n### Documentation\n\nFull library documentation can be found on CocoaDocs: http://cocoadocs.org/docsets/AWSPushManager/\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffetch%2Fawspushmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffetch%2Fawspushmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffetch%2Fawspushmanager/lists"}