{"_id":"55a9094827a17d210052522a","parentDoc":null,"category":{"_id":"55b9ff90eb08801900f833e5","pages":[],"__v":0,"project":"5540ce1b31827a0d007ab1cc","version":"5540ce1c31827a0d007ab1cf","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-30T10:42:24.499Z","from_sync":false,"order":21,"slug":"xamarin","title":"Xamarin"},"version":{"_id":"5540ce1c31827a0d007ab1cf","project":"5540ce1b31827a0d007ab1cc","__v":31,"createdAt":"2015-04-29T12:27:08.390Z","releaseDate":"2015-04-29T12:27:08.390Z","categories":["5540ce1c31827a0d007ab1d0","5540d91bbb9e762d00f594ad","5540e5f131827a0d007ab212","5540e5febb9e762d00f594d3","5540e61331827a0d007ab213","5540e6195cf9682100d61afa","5540e62631827a0d007ab214","5540e63031827a0d007ab215","5540e63531827a0d007ab216","5540e63e5cf9682100d61afc","5540e6445cf9682100d61afd","5540e64a5cf9682100d61afe","55a4ff5b2e70c0250038050f","55acb28318eefd0d0071d504","55ae1abe8576b92300291c80","55ae453ef302af23000ac109","55af586d555b900d0036d296","55af91dac8a85321007a53c3","55b9fee204775a2f00628071","55b9ff0e04775a2f00628072","55b9ff4604775a2f00628073","55b9ff5fd72d1e1900276a38","55b9ff7f04775a2f00628074","55b9ff90eb08801900f833e5","55b9ffa5d72d1e1900276a39","55b9ffca04775a2f00628075","55b9fffdd72d1e1900276a3a","56bc2f033ee9e70d008b46af","56c2f6efbbf9ec2d00e0fe4f","57595bbb18760817001e8bbe","57d8d9793916800e003dde53"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":19,"project":"5540ce1b31827a0d007ab1cc","user":"55a5003a750a9a23005332b6","updates":["55e0b20e6bad670d0081f2e8","55e0b37d186ca30d00f9b4fb","56c1d550d3199a0d00694bab"],"next":{"pages":[],"description":""},"createdAt":"2015-07-17T13:55:20.403Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[**Download Module**](https://github.com/Pushwoosh/pushwoosh-xamarin/tree/master/SDK/Pushwoosh.iOS)\n[**Download Sample**](https://github.com/Pushwoosh/pushwoosh-xamarin/tree/master/Samples/iOS) \n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"iOS Simulator can neither subscribe to nor receive push notifications.\"\n}\n[/block]\nTo integrate Pushwoosh with your Xamarin iOS application:\n\n**1.** Add  **Pushwoosh.Xamarin.iOS** nuget package to your solution.\n\n**2.** In your project, open  **AppDelegate.cs** and connect Pushwoosh by adding the `using Pushwoosh` line.\n\n**3.** In your **Info.plist** add `Pushwoosh_APPID` key with your Pushwoosh Application ID string value.\n\n**4.** Organize the following imports:\n\n* using Pushwoosh;\n* using UserNotifications;\n\n**5.** Add the methods below to **AppDelegate class**:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)\\n{\\n    PushNotificationManager.PushManager.HandlePushRegistration (deviceToken);\\n}\\n \\npublic override void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)\\n{\\n    PushNotificationManager.PushManager.HandlePushRegistrationFailure (error);\\n}\\n \\npublic override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)        \\n{\\n     PushNotificationManager.PushManager.HandlePushReceived (userInfo);\\n}\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n**6.** Add the code below to `public override bool FinishedLaunching(UIApplication app, NSDictionary launchOptions)` method:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PushNotificationManager pushmanager = PushNotificationManager.PushManager;\\npushmanager.Delegate = this;\\nUNUserNotificationCenter.Current.Delegate = pushmanager.notificationCenterDelegate;\\n \\nif (options != null) {\\n     if (options.ContainsKey (UIApplication.LaunchOptionsRemoteNotificationKey)) { \\n       pushmanager.HandlePushReceived(options);\\n     }\\n}\\n \\npushmanager.RegisterForPushNotifications();\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n**7.** To use Geozones, add the line below to the same method:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pushmanager.StartLocationTracking();\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]","excerpt":"Integrating Pushwoosh SDK into your Xamarin iOS project","slug":"xamarin-ios-sdk","type":"basic","title":"Xamarin iOS SDK"}

Xamarin iOS SDK

Integrating Pushwoosh SDK into your Xamarin iOS project

[**Download Module**](https://github.com/Pushwoosh/pushwoosh-xamarin/tree/master/SDK/Pushwoosh.iOS) [**Download Sample**](https://github.com/Pushwoosh/pushwoosh-xamarin/tree/master/Samples/iOS) [block:callout] { "type": "info", "body": "iOS Simulator can neither subscribe to nor receive push notifications." } [/block] To integrate Pushwoosh with your Xamarin iOS application: **1.** Add **Pushwoosh.Xamarin.iOS** nuget package to your solution. **2.** In your project, open **AppDelegate.cs** and connect Pushwoosh by adding the `using Pushwoosh` line. **3.** In your **Info.plist** add `Pushwoosh_APPID` key with your Pushwoosh Application ID string value. **4.** Organize the following imports: * using Pushwoosh; * using UserNotifications; **5.** Add the methods below to **AppDelegate class**: [block:code] { "codes": [ { "code": "public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)\n{\n PushNotificationManager.PushManager.HandlePushRegistration (deviceToken);\n}\n \npublic override void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)\n{\n PushNotificationManager.PushManager.HandlePushRegistrationFailure (error);\n}\n \npublic override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo) \n{\n PushNotificationManager.PushManager.HandlePushReceived (userInfo);\n}", "language": "csharp" } ] } [/block] **6.** Add the code below to `public override bool FinishedLaunching(UIApplication app, NSDictionary launchOptions)` method: [block:code] { "codes": [ { "code": "PushNotificationManager pushmanager = PushNotificationManager.PushManager;\npushmanager.Delegate = this;\nUNUserNotificationCenter.Current.Delegate = pushmanager.notificationCenterDelegate;\n \nif (options != null) {\n if (options.ContainsKey (UIApplication.LaunchOptionsRemoteNotificationKey)) { \n pushmanager.HandlePushReceived(options);\n }\n}\n \npushmanager.RegisterForPushNotifications();", "language": "csharp" } ] } [/block] **7.** To use Geozones, add the line below to the same method: [block:code] { "codes": [ { "code": "pushmanager.StartLocationTracking();", "language": "csharp" } ] } [/block]