{"id":815,"date":"2020-09-06T16:59:51","date_gmt":"2020-09-06T07:59:51","guid":{"rendered":"https:\/\/naoya-ono.com\/swift\/?p=815"},"modified":"2020-09-06T16:59:51","modified_gmt":"2020-09-06T07:59:51","slug":"swift-admob-interstitial","status":"publish","type":"post","link":"https:\/\/naoya-ono.com\/swift\/swift-admob-interstitial\/","title":{"rendered":"\u3010Swift\u3011\u30a2\u30d7\u30ea\u306bGoogle AdMob\u306e\u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30a3\u30b7\u30e3\u30eb\u5e83\u544a\u3092\u8cbc\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u4ee5\u524d\u3001\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067iOS\u30a2\u30d7\u30ea\u306bGoogle AdMob\u306e\u30d0\u30ca\u30fc\u5e83\u544a\u3092\u8cbc\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><a class=\"linkto table\" href=\"https:\/\/naoya-ono.com\/swift\/swift-admob-banner\/\"><span class=\"tbcell tbimg\"><img loading=\"lazy\" width=\"160\" height=\"160\" src=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/swift-admob-banner-160x160.png\" class=\"attachment-thumb-160 size-thumb-160 wp-post-image\" alt=\"\" decoding=\"async\" srcset=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/swift-admob-banner-160x160.png 160w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/swift-admob-banner-150x150.png 150w\" sizes=\"(max-width: 160px) 100vw, 160px\"><\/span><span class=\"tbcell tbtext\">\u3010Swift\u3011\u30a2\u30d7\u30ea\u306bGoogle AdMob\u306e\u30d0\u30ca\u30fc\u5e83\u544a\u3092\u8cbc\u308b\u65b9\u6cd5<\/span><\/a><\/p>\n<p>\u4eca\u56de\u306f\u305d\u306e\u95a2\u9023\u8a18\u4e8b\u3068\u3057\u3066\u3001\u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30a3\u30b7\u30e3\u30eb\u5e83\u544a\u3092\u8cbc\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30a3\u30b7\u30e3\u30eb\u5e83\u544a\u3068\u306f\u30dc\u30bf\u30f3\u3084\u30bb\u30eb\u306a\u3069\u3092\u62bc\u3057\u3066\u753b\u9762\u9077\u79fb\u3059\u308b\u6642\u306b\u3001\u753b\u9762\u3044\u3063\u3071\u3044\u306b\u8868\u793a\u3055\u308c\u308b\u5e83\u544a\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/swift-admob-interstitial1.png\" alt=\"\" width=\"378\" height=\"666\" class=\"alignnone wp-image-818 \" srcset=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/swift-admob-interstitial1.png 581w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/swift-admob-interstitial1-170x300.png 170w\" sizes=\"(max-width: 378px) 100vw, 378px\"><\/p>\n<h2 class=\"hh hh5 pastel-bc\" id=\"i-0\">\u524d\u6e96\u5099<\/h2>\n<p>Google AdMob\u3092\u5229\u7528\u3059\u308b\u306b\u306f\u3001\u307e\u305a\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u767b\u9332\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p>\u4e0b\u306e\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001AdMob\u5229\u7528\u306e\u7533\u8acb\u3092\u6e08\u307e\u305b\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><a href=\"https:\/\/admob.google.com\/home\/\" class=\"btn raised blue-bc strong\">Google AdMob\u516c\u5f0f\u30b5\u30a4\u30c8<\/a><br \/>\n<script src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\" async><\/script><br \/>\n<ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-4166043434922569\" data-ad-slot=\"7750996733\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<h2 class=\"hh hh5 pastel-bc\" id=\"i-1\">AdMob\u5c0e\u5165\u307e\u3067\u306e\u5168\u4f53\u306e\u6d41\u308c<\/h2>\n<p>\u3067\u306f\u3001\u3053\u308c\u304b\u3089AdMob\u5c0e\u5165\u306e\u624b\u9806\u3092\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u304c\u3001\u5148\u306b\u5168\u4f53\u306e\u6d41\u308c\u3092\u307e\u3068\u3081\u3066\u304a\u304f\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"sng-box box5\">\n<div class=\"ol-circle li-accentbdr acc-bc-before\">\n<ol>\n<li>AdMob\u7528\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/li>\n<li>\u30e2\u30d0\u30a4\u30eb\u5e83\u544a\u306e\u521d\u671f\u5316\uff08AppDelegate.swif\uff09<\/li>\n<li>Info.plist\u3078\u306e\u30ad\u30fc\u306e\u767b\u9332<\/li>\n<li>\u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30a3\u30b7\u30e3\u30eb\u5e83\u544a\u8868\u793a\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<p>\uff11\u301c\uff13\u307e\u3067\u306f<a href=\"https:\/\/naoya-ono.com\/swift\/swift-admob-banner\/\"><strong>\u30d0\u30ca\u30fc\u5e83\u544a\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5<\/strong><\/a>\u306e\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u4eca\u56de\u306f\uff14\u3060\u3051\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h2 class=\"hh hh5 pastel-bc\" id=\"i-2\">STEP4.\u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30a3\u30b7\u30e3\u30eb\u5e83\u544a\u8868\u793a\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0<\/h2>\n<p>\u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30b7\u30e3\u30eb\u5e83\u544a\u3092\u8aad\u307f\u8fbc\u3093\u3067\u8868\u793a\u3059\u308b\u306b\u306f\u6b21\u306e\u3088\u3046\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-swift\" data-lang=\"Swift\"><code>import UIKit\nimport GoogleMobileAds \/\/ \u2460 \u8ffd\u52a0\n\nclass ViewController: UIViewController, GADInterstitialDelegate { \/\/ \u2461 GADInterstitialDelegate\u3092\u8ffd\u52a0\n\n&nbsp; &nbsp; var interstitial: GADInterstitial! \/\/ \u2462 \u8aad\u307f\u8fbc\u3093\u3060\u5e83\u544a\u3092\u683c\u7d0d\u3059\u308b\u5909\u6570\n\n&nbsp; &nbsp; override func viewDidLoad() {\n&nbsp; &nbsp; &nbsp; &nbsp; super.viewDidLoad()&nbsp;&nbsp; &nbsp; \n\n&nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u2463 \u5e83\u544a\u3092\u4f5c\u6210\u3057\u8aad\u307f\u8fbc\u3080\n&nbsp; &nbsp; &nbsp; &nbsp; interstitial = createAndLoadInterstitial()\n&nbsp; &nbsp; }\n&nbsp; &nbsp;\n&nbsp; &nbsp; \/\/ \u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30a3\u30b7\u30e3\u30eb\u5e83\u544a\u3092\u4f5c\u6210\u3057\u8aad\u307f\u8fbc\u3080\n&nbsp; &nbsp; func createAndLoadInterstitial() -&gt; GADInterstitial {\n\n&nbsp; &nbsp; &nbsp; &nbsp; var interstitial = GADInterstitial(adUnitID: \"ca-app-pub-3940256099942544\/4411468910\")\n&nbsp; &nbsp; &nbsp; &nbsp; interstitial.delegate = self\n&nbsp; &nbsp; &nbsp; &nbsp; interstitial.load(GADRequest())\n&nbsp; &nbsp; &nbsp; &nbsp; return interstitial\n&nbsp; &nbsp; }\n&nbsp;&nbsp; &nbsp;\n&nbsp; &nbsp; \/\/ \u5e83\u544a\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u958b\u3044\u305f\u753b\u9762\u3092\u9589\u3058\u305f\u76f4\u5f8c\u306b\u547c\u3070\u308c\u308b\n&nbsp; &nbsp; func interstitialDidDismissScreen(_ ad: GADInterstitial) {  \n\n        \/\/ \u2465 \u65b0\u305f\u306a\u5e83\u544a\u3092\u4f5c\u6210\u3057\u8aad\u307f\u8fbc\u3080\n&nbsp; &nbsp; &nbsp; &nbsp; interstitial = createAndLoadInterstitial()\n&nbsp; &nbsp; }\n&nbsp;&nbsp; &nbsp;\n&nbsp; &nbsp; \/\/ \u30dc\u30bf\u30f3\u304c\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u6642\u306b\u5e83\u544a\u306e\u8868\u793a\u6e96\u5099\u304c\u3067\u304d\u3066\u3044\u308c\u3070\u8868\u793a\u3059\u308b\n&nbsp; &nbsp; @IBAction func buttonPressed(_ sender: UIButton) {\n\n       \/\/ \u2464\u5e83\u544a\u306e\u8868\u793a\u6e96\u5099\u304c\u3067\u304d\u3066\u3044\u308c\u3070\u3001\u8868\u793a\u3059\u308b\n&nbsp; &nbsp; &nbsp; &nbsp; if interstitial.isReady {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; interstitial.present(fromRootViewController: self)\n&nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; &nbsp; &nbsp; self.navigationController?.popViewController(animated: true)\n&nbsp; &nbsp; }\n}<\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u524d\u3001\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067iOS\u30a2\u30d7\u30ea\u306bGoogle AdMob\u306e\u30d0\u30ca\u30fc\u5e83\u544a\u3092\u8cbc\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002 \u4eca\u56de\u306f\u305d\u306e\u95a2\u9023\u8a18\u4e8b\u3068\u3057\u3066\u3001\u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30a3\u30b7\u30e3\u30eb\u5e83\u544a\u3092\u8cbc\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30a3\u30b7\u30e3\u30eb\u5e83\u544a\u3068\u306f\u30dc\u30bf\u30f3\u3084\u30bb\u30eb\u306a\u3069\u3092\u62bc &#8230; <\/p>\n","protected":false},"author":1,"featured_media":816,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/posts\/815"}],"collection":[{"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/comments?post=815"}],"version-history":[{"count":4,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/posts\/815\/revisions"}],"predecessor-version":[{"id":821,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/posts\/815\/revisions\/821"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/media\/816"}],"wp:attachment":[{"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/media?parent=815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/categories?post=815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/tags?post=815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}