{"id":703,"date":"2014-10-24T12:05:50","date_gmt":"2014-10-24T03:05:50","guid":{"rendered":"http:\/\/androiphone.uvs.jp\/?p=703"},"modified":"2015-11-09T13:41:41","modified_gmt":"2015-11-09T04:41:41","slug":"ioscocos2d-v2-xcclayer%e3%81%8b%e3%82%89interstitial%e5%ba%83%e5%91%8a%e3%81%ae%e8%a1%a8%e7%a4%ba","status":"publish","type":"post","link":"https:\/\/androiphone.uvs.jp\/?p=703","title":{"rendered":"[iOS][cocos2d v2.x]CCLayer\u304b\u3089interstitial\u5e83\u544a\u306e\u8868\u793a"},"content":{"rendered":"<p>\u6700\u8fd1\u306eApple\u306e\u5be9\u67fb\u3067Reject\u9023\u767a\u3067\u3078\u3053\u3093\u3067\u3044\u307e\u3059\u3002\u4e00\u56de\u3067\u5168\u90e8\u306e\u6307\u6458\u3092\u3044\u3063\u3066\u307b\u3059\u3043\u306a\u3041\u3068\u304b\u30fb\u30fb\u30fb \u3057\u304b\u3082iOS8\u3068iphone6,6+,ipad\u306e\u30ea\u30ea\u30fc\u30b9\u3067\u5be9\u67fb\u304c\u6fc0\u6df7\u307f\u3067\u3059\u30fb\u30fb\u30fb<\/p>\n<p>\u305d\u308c\u306f\u305d\u3046\u3068\uff64\u307e\u3060Cocos2d-iphone\u306e\u3057\u304b\u3082ver2.x\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u304b\u3068\u8a00\u308f\u308c\u305d\u3046\u3067\u3059\u304c\u3001\u624b\u3092\u4ed8\u3051\u3066\u3044\u305f\u306e\u304c v2.x\u3067\u3057\u3066\u30fb\u30fb\u30fbv3.x\u306b\u66f8\u304d\u63db\u3048\u308b\u306e\u3082\u3081\u3093\u3069\u304f\u3055\u3044\u3057\u30fb\u30fb\u30fb\u30b4\u30cb\u30e7\u30b4\u30cb\u30e7<\/p>\n<p>\u3048?Cocos2d-x\u3058\u3083\u306d\u30fc\u306e?\u3063\u3066\u30fb\u30fb\u30fb2d-x\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u3057\u3066\u3001\u4f7f\u3048\u308b\u3093\u3067\u3059\u3051\u3069\u30fb\u30fb\u30fb\u30b4\u30cb\u30e7\u30b4\u30cb\u30e7<\/p>\n<p>\u307e\u3041\u3001\u4f55\u304b\u3082\u5f79\u306b\u7acb\u3064\u304b\u3082\u3057\u308c\u306a\u3044\u306e\u3067\u3001CCLayer\u304b\u3089\u3001interstitial\u3092\u4f7f\u3046\u65b9\u6cd5\u3092\u3061\u3087\u3063\u3068\u5fa1\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p><a title=\"https:\/\/developers.google.com\/mobile-ads-sdk\/docs\/admob\/ios\/interstitial?hl=ja\" href=\"https:\/\/developers.google.com\/mobile-ads-sdk\/docs\/admob\/ios\/interstitial?hl=ja\"> https:\/\/developers.google.com\/mobile-ads-sdk\/docs\/admob\/ios\/interstitial?hl=ja<\/a><\/p>\n<p>\u3053\u308c\u3092\u307f\u308b\u3068\u3001\u6700\u7d42\u7684\u306bViewController\u306b\u6e21\u3059\u307f\u305f\u3044\u306a\u3093\u3067\u3059\u3002 \u3044\u308d\u3044\u308d\u3001\u898b\u3066\u307f\u3066\u3082\u4eca\u4e00\u3001\u30d4\u30f3\u3068\u304f\u308b\u65b9\u6cd5\u304c\u306a\u304f\u3066AppController\u304b\u3089\u30d3\u30e5\u30fc\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u53d6\u5f97\u3057\u3066\u305d\u308c\u306b\u5165\u308c\u3088\u30fc\u304b \u3068\u3082\u601d\u3063\u305f\u3093\u3067\u3059\u304c\u3001InterstitialViewController\u3092\u4f5c\u3063\u3066\u3001\u751f\u6210\u6642\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3044\u3001\u8868\u793a\u3059\u308b\u3068\u3044\u3046\u65b9\u6cd5\u3067 \u3084\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u30b3\u30fc\u30c9<\/p>\n<p>InterstitialViewController.h<\/p>\n<pre>[obj-c]\r\n#import &amp;lt;UIKit\/UIKit.h&amp;gt;\r\n#import &quot;GADInterstitial.h&quot;\r\n\r\n@interface InterstitialViewController : UIViewController{\r\n        GADInterstitial *interstitial;\r\n}\r\n\r\n- (id)init;\r\n- (BOOL)interstitialIsReady;\r\n\r\n@end\r\n[\/obj-c]<\/pre>\n<p>InterstitialViewController.m<\/p>\n<pre>[obj-c]\r\n#import &quot;InterstitialViewController.h&quot;\r\n\r\n@interface InterstitialViewController ()\r\n\r\n@end\r\n\r\n@implementation InterstitialViewController\r\n\r\n- (id)init {\r\n    if (self = [super init]) {\r\n        \/\/\u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30a3\u30b7\u30e3\u30eb\u5e83\u544a\u6e96\u5099\r\n        interstitial = [[GADInterstitial alloc] init];\r\n        interstitial.adUnitID = ADMOB_INT_ID;\r\n        GADRequest *request = [GADRequest request];\r\n        \/\/ Requests test ads on simulators.\r\n        \/\/request.testDevices = @[ GAD_SIMULATOR_ID ];\r\n        [interstitial loadRequest:request];\r\n    }\r\n    return self;\r\n}\r\n\r\n- (BOOL)interstitialIsReady{\r\n    \r\n    return [interstitial isReady];\r\n    \r\n}\r\n\r\n- (void)viewDidLoad {\r\n    [super viewDidLoad];\r\n}\r\n\r\n- (void)viewDidAppear:(BOOL)animated{\r\n    if(![interstitial hasBeenUsed]){\r\n        [interstitial presentFromRootViewController:self.view.window.rootViewController];\r\n    }\r\n}\r\n\r\n- (void)didReceiveMemoryWarning {\r\n    [super didReceiveMemoryWarning];\r\n}\r\n@end\r\n[\/obj-c]<\/pre>\n<p>\u3067\u3001CCLayer\u3067\u3069\u3046\u4f7f\u3046\u304b\u3068\u3044\u3046\u3068\u629c\u7c8b\u30b3\u30fc\u30c9 SenceLayer.m<\/p>\n<pre>[obj-c]\r\n-(id) init\r\n{\r\n    if( (self=[super init])) {\r\n        \/\/ivc\u306fInterstitialViewController\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u30e1\u30f3\u30d0\u5909\u6570\u3068\u3057\u3066.h\u3067\u5ba3\u8a00\u3057\u3068\u3044\u3066\u304f\u3060\u3055\u3044\r\n        ivc = [[InterstitialViewController alloc]init];\r\n     }\r\n}\r\n\r\n\/\/ ---- \u4ed6\u306e\u7121\u95a2\u4fc2\u30b3\u30fc\u30c9\r\n\r\n\/\/\u623b\u308b\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u305f\u3068\u304d\u306b\u547c\u3070\u308c\u308b\u3000\u3053\u306e\u3068\u304d\u306b\u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30a3\u30b7\u30e3\u30eb\u5e83\u544a\u306e\u8868\u793a\r\n-(void)back_btn_push:(id)sender{\r\n    \/\/HogeHogeLayer\u306b\u623b\u308b\r\n    [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:0.5f scene:[HogehogeLayer scene]]];\r\n \r\n    \/\/\u6e96\u5099\u304c\u51fa\u6765\u308c\u3066\u3044\u308c\u3070\u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30a3\u30b7\u30e3\u30eb\u3092\u8868\u793a\r\n    if ([ivc interstitialIsReady]) {\r\n        NSLog(@&quot;\u30a4\u30f3\u30bf\u30fc\u30b9\u30c6\u30a3\u30b7\u30e3\u30eb\u30ed\u30fc\u30c9\u5b8c\u4e86\u6e08&quot;);\r\n        [[[CCDirector sharedDirector] view] addSubview:ivc.view];\r\n    }\r\n}\r\n[\/obj-c]<\/pre>\n<p>\u307e\u3041\u3001\u306a\u3093\u3066\u3053\u3068\u306f\u306a\u3044\u3093\u3067\u3059\u304c\u3001\u3053\u3046\u3057\u3068\u3051\u3070\u3001\u3044\u3061\u3044\u3061CCLayer\u6bce\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u304b\u306a\u304f\u3066\u3082\u3001InterstitialViewController\u3092 \u547c\u3073\u51fa\u305b\u3070\u4f7f\u3048\u308b\u3093\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u301c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u306eApple\u306e\u5be9\u67fb\u3067Reject\u9023\u767a\u3067\u3078\u3053\u3093\u3067\u3044\u307e\u3059\u3002\u4e00\u56de\u3067\u5168\u90e8\u306e\u6307\u6458\u3092\u3044\u3063\u3066\u307b\u3059\u3043\u306a\u3041\u3068\u304b\u30fb\u30fb\u30fb \u3057\u304b\u3082iOS8\u3068iphone6,6+,ipad\u306e\u30ea\u30ea\u30fc\u30b9\u3067\u5be9\u67fb\u304c\u6fc0\u6df7\u307f\u3067\u3059\u30fb\u30fb\u30fb \u305d\u308c\u306f\u305d\u3046\u3068\uff64\u307e\u3060Cocos2d- [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"","_original_post":"","footnotes":""},"categories":[12,7,8],"tags":[],"class_list":["post-703","post","type-post","status-publish","format-standard","hentry","category-cocos2d","category-ios","category--ios","ja"],"_links":{"self":[{"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/posts\/703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=703"}],"version-history":[{"count":8,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/posts\/703\/revisions"}],"predecessor-version":[{"id":893,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=\/wp\/v2\/posts\/703\/revisions\/893"}],"wp:attachment":[{"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/androiphone.uvs.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}