{"id":157,"date":"2015-08-29T15:54:42","date_gmt":"2015-08-29T15:54:42","guid":{"rendered":"http:\/\/blog.lizefield.mobi\/?p=157"},"modified":"2015-08-29T15:54:42","modified_gmt":"2015-08-29T15:54:42","slug":"microsoft-azure%e3%81%8b%e3%82%89ios%e3%81%b8%e3%83%97%e3%83%83%e3%82%b7%e3%83%a5%e9%80%9a%e7%9f%a5%ef%bc%88swift%ef%bc%89%ef%bc%88%e3%81%9d%e3%81%ae%ef%bc%92%ef%bc%89","status":"publish","type":"post","link":"https:\/\/lizefieldwp.azurewebsites.net\/index.php\/2015\/08\/29\/microsoft-azure%e3%81%8b%e3%82%89ios%e3%81%b8%e3%83%97%e3%83%83%e3%82%b7%e3%83%a5%e9%80%9a%e7%9f%a5%ef%bc%88swift%ef%bc%89%ef%bc%88%e3%81%9d%e3%81%ae%ef%bc%92%ef%bc%89\/","title":{"rendered":"Microsoft Azure\u304b\u3089iOS\u3078\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\uff08Swift\uff09\uff08\u305d\u306e\uff12\uff09"},"content":{"rendered":"<p>Microsoft\u00a0Azure\u306b\u8a2d\u7f6e\u3057\u305fWeb Apps\u304b\u3089iOS\u3078\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u3092\u9001\u308b\u305f\u3081\u306bMicrosoft Azure\u306eNotification Hub\u3092\u5229\u7528\u3057\u3066\u307f\u307e\u3059\u3002\uff08\u305d\u306e\uff12\uff09<br \/>\niOS:8.4.1<br \/>\nXcode:6.4<br \/>\nSwift:1.2<br \/>\nMobile Services iOS SDK:1.2.4<\/p>\n<p><!--more--><\/p>\n<p><a href=\"http:\/\/blog.lizefield.mobi\/?p=140\" rel=\"nofollow\">\u524d\u56de<\/a>\u8a2d\u5b9a\u3057\u305fMicrosoft Azure\u306e\u901a\u77e5\u30cf\u30d6\u304b\u3089\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u53d7\u4fe1\u3059\u308b\u305f\u3081\u306e\u8a2d\u5b9a\u3092iOS\u30a2\u30d7\u30ea\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p><b>1.WindowsAzureMessaging.framework\u306e\u8ffd\u52a0<\/b><br \/>\n<a href=\"https:\/\/github.com\/Azure\/azure-mobile-services\/blob\/master\/CHANGELOG.ios.md#sdk-downloads\" target=\"_blank\" rel=\"nofollow\">Mobile Services iOS SDK<\/a>\u306e\u300ciOS 1.2.4 SDK\u300d\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<br \/>\n\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u300cazuresdk-iOS-v1\u300d\u306e\u4e2d\u306b\u3042\u308b\u300cWindowsAzureMessaging.framework\u300d\u3092Xcode\u306eProject navigator\u306e\u7a7a\u3044\u3066\u308b\u8fba\u308a\u306b\u30c9\u30e9\u30c3\u30b0\u3057\u3066\u8ffd\u52a0\u3057\u307e\u3059\u3002<br \/>\n<a href=\"\/wp-content\/uploads\/2015\/08\/ios_notification_01.png\"><img loading=\"lazy\" class=\"alignnone wp-image-146\" src=\"\/wp-content\/uploads\/2015\/08\/ios_notification_01.png\" alt=\"ios_notification_01\" width=\"300\" height=\"191\" srcset=\"\/wp-content\/uploads\/2015\/08\/ios_notification_01.png 2784w, \/wp-content\/uploads\/2015\/08\/ios_notification_01-300x191.png 300w, \/wp-content\/uploads\/2015\/08\/ios_notification_01-768x488.png 768w, \/wp-content\/uploads\/2015\/08\/ios_notification_01-1024x651.png 1024w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\u00a0<a href=\"\/wp-content\/uploads\/2015\/08\/ios_notification_02.png\"><img loading=\"lazy\" class=\"alignnone wp-image-147\" src=\"\/wp-content\/uploads\/2015\/08\/ios_notification_02.png\" alt=\"ios_notification_02\" width=\"150\" height=\"144\" \/><\/a><\/p>\n<p><b>2.\u30d6\u30ea\u30c3\u30b8\u30f3\u30b0\u30d8\u30c3\u30c0\u306e\u8ffd\u52a0<\/b><br \/>\nMobile Service iOS SDK\u306fObjective-C\u306a\u306e\u3067Swift\u3067\u4f7f\u3046\u5834\u5408\u306b\u306f\u30d6\u30ea\u30c3\u30b8\u30f3\u30b0\u30d8\u30c3\u30c0\u304c\u5fc5\u8981\u306b\u306a\u308b\u305f\u3081\u300cNew File&#8230;\u300d\u3067\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u300cAzureMessaging-Bridging-Header.h\u300d\u3068\u3057\u307e\u3059\u3002<br \/>\n<a href=\"\/wp-content\/uploads\/2015\/08\/ios_notification_21.png\"><img loading=\"lazy\" class=\"alignnone wp-image-148\" src=\"\/wp-content\/uploads\/2015\/08\/ios_notification_21.png\" alt=\"ios_notification_21\" width=\"300\" height=\"191\" \/><\/a><a href=\"\/wp-content\/uploads\/2015\/08\/ios_notification_22.png\"><img loading=\"lazy\" class=\"alignnone wp-image-149\" src=\"\/wp-content\/uploads\/2015\/08\/ios_notification_22.png\" alt=\"ios_notification_22\" width=\"300\" height=\"191\" \/><\/a><a href=\"\/wp-content\/uploads\/2015\/08\/ios_notification_23.png\"><img loading=\"lazy\" class=\"alignnone wp-image-150\" src=\"\/wp-content\/uploads\/2015\/08\/ios_notification_23.png\" alt=\"ios_notification_23\" width=\"150\" height=\"148\" \/><\/a><\/p>\n<p>\u4f5c\u6210\u3057\u305f\u30d6\u30ea\u30c3\u30b8\u30f3\u30b0\u30d8\u30c3\u30c0\u3092\u5229\u7528\u51fa\u6765\u308b\u3088\u3046\u300cSwift Compiler\u300d\u306e\u300cObjective-C Bridging Header\u300d\u306b\u30d1\u30b9\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<br \/>\n<a href=\"\/wp-content\/uploads\/2015\/08\/ios_notification_24.png\"><img loading=\"lazy\" class=\"alignnone wp-image-152\" src=\"\/wp-content\/uploads\/2015\/08\/ios_notification_24.png\" alt=\"ios_notification_24\" width=\"300\" height=\"191\" srcset=\"\/wp-content\/uploads\/2015\/08\/ios_notification_24.png 2784w, \/wp-content\/uploads\/2015\/08\/ios_notification_24-300x191.png 300w, \/wp-content\/uploads\/2015\/08\/ios_notification_24-768x488.png 768w, \/wp-content\/uploads\/2015\/08\/ios_notification_24-1024x651.png 1024w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u4f5c\u6210\u3057\u305f\u30d6\u30ea\u30c3\u30b8\u30f3\u30b0\u30d8\u30c3\u30c0\u306e\u5185\u5bb9\u3092\u4ee5\u4e0b\u306b\u66f8\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n<pre>#import \"WindowsAzureMessaging\/WindowsAzureMessaging.h\"\n<\/pre>\n<p><b>3.\u30c7\u30d0\u30a4\u30b9\u30c8\u30fc\u30af\u30f3\u306e\u53d6\u5f97\u3068Azure Notification Hubs\u3078\u306e\u767b\u9332<\/b><br \/>\nAzure Notification Hubs\u4e0a\u3067\u3082\u30c7\u30d0\u30a4\u30b9\u3092\u7ba1\u7406\u3059\u308b\u305f\u3081\u3001\u30c7\u30d0\u30a4\u30b9\u30c8\u30fc\u30af\u30f3\u3092\u767b\u9332\u3059\u308b\u51e6\u7406\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\u306a\u304a\u3001\u901a\u77e5\u30cf\u30d6\u3078\u767b\u9332\u3055\u308c\u305f\u30c7\u30d0\u30a4\u30b9\u306e\u6709\u52b9\u671f\u9593\u306f90\u65e5\u306e\u3088\u3046\u3067\u3059\u3002\uff08\u53c2\u8003\u300c<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/azure\/dn530747.aspx\" target=\"_blank\" rel=\"nofollow\">\u767b\u9332\u7ba1\u7406<\/a>\u300d\uff09<br \/>\n\u300cAppDelegate.swift\u300d\u306e\u8a18\u8ff0\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre>func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool {\n    \/\/ Notification\u3092\u4f7f\u3046\u8a2d\u5b9a\n    if (UIDevice.currentDevice().systemVersion as NSString).floatValue &gt;= 8.0 {\n        \/\/ iOS Version 8.0 \u4ee5\u4e0a\u306e\u51e6\u7406\n        let types = UIUserNotificationType.Badge | UIUserNotificationType.Sound | UIUserNotificationType.Alert\n        let settings = UIUserNotificationSettings(forTypes: types, categories: nil)\n        \n        application.registerUserNotificationSettings(settings)\n        application.registerForRemoteNotifications()\n    } else {\n        \/\/ iOS Version 8.0 \u3088\u308a\u4e0b\u306e\u51e6\u7406\n        application.registerForRemoteNotificationTypes(UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound | UIRemoteNotificationType.Alert)\n    }\n    return true\n}\n\n\/\/ \u8ffd\u52a0\nfunc application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {\n    \/\/ \u901a\u77e5\u30cf\u30d6\u540d\n    let notificationHubName = \"notification-ns\";\n    \/\/ DefaultFullSharedAccessSignature\n    let notificationHubConnection = \"Endpoint=\uff5e\uff5e\uff5e\uff5e\uff5e;SharedAccessKey=XXxxxXXXX9xxXXx9xX99\";\n    \/\/ \u901a\u77e5\u30cf\u30d6\u3078\u30c7\u30d0\u30a4\u30b9\u306e\u767b\u9332\n    var hub = SBNotificationHub(connectionString: notificationHubConnection, notificationHubPath: notificationHubName)\n    hub.registerNativeWithDeviceToken(deviceToken, tags: nil, completion: {(error) -&gt; Void in\n        if (error != nil) {\n            println(\"Regist Error:\\(error)\")\n        } else {\n            println(\"Regist Success:\\(deviceToken)\")\n        }\n    })\n}\n\n\/\/ \u8ffd\u52a0\nfunc application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {\n    \/\/ \u901a\u77e5\u3092\u53d7\u4fe1\u3057\u305f\u5834\u5408\u306e\u51e6\u7406\n    println(\"receive notification:\\(userInfo.description)\")\n}\n<\/pre>\n<p><a href=\"http:\/\/blog.lizefield.mobi\/?p=182\" rel=\"nofollow\">\u6b21\u56de<\/a>\u306fWeb Apps\u3067\u306e\u9001\u4fe1\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft\u00a0Azure\u306b\u8a2d\u7f6e\u3057\u305fWeb Apps\u304b\u3089iOS\u3078\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u3092\u9001\u308b\u305f\u3081\u306bMicrosoft Azure\u306eNotification Hub\u3092\u5229\u7528\u3057\u3066\u307f\u307e\u3059\u3002\uff08\u305d\u306e\uff12\uff09 iOS:8.4.1 Xcode:6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,9],"tags":[24,43,45,55,66],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/lizefieldwp.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts\/157"}],"collection":[{"href":"https:\/\/lizefieldwp.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lizefieldwp.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lizefieldwp.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lizefieldwp.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/comments?post=157"}],"version-history":[{"count":0,"href":"https:\/\/lizefieldwp.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts\/157\/revisions"}],"wp:attachment":[{"href":"https:\/\/lizefieldwp.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/media?parent=157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lizefieldwp.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/categories?post=157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lizefieldwp.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/tags?post=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}