Implementing iAd in Cocos2d V3 with MyiAd - cocos2d-iphone

I downloaded iAd Banner Sample for cocos2d V3. Thanks so much for that code. The demo works fine and needs the user to tap Show Ad or Hide Ad button. Of course in my game I do not want the player to tap a button to Show Ads. In IntroScene.m I commented out the code that creates the buttons and added these lines at the end of init:
AppDelegate * app = (((AppDelegate*) [UIApplication sharedApplication].delegate));
[app ShowIAdBanner];
This is the same code that would have been executed if the Show Ad button had been pressed. I expected to see an ad without having to tap a button. However, I got no ad. I got the following error message in the log:
ADBannerView: Unhandled error (no delegate or delegate does not
implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain
Code=2 "The operation couldn’t be completed. Loading throttled"
There is -(void)bannerDidFail method in AppDelegate. It works by tapping button. How do I get the ads to show up automatically, without tapping a button first? Thanks.

The error seems to tell you exactly what is happening. Make sure that you have the following line:
bannerView.delegate = self; //bannerView is an object of type AdBannerView* that you created before
Check also that the class where the previous line is, implements the method:
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
I recently wrote a tutorial on integrating iAds in Cocos2d-x v3. Although the language is different (C++ instead of Objective-C), the procedure and syntax are rather similar: http://becomingindiedev.blogspot.com.es/2015/02/integrating-iad-in-cocos2d-x-v3x.html

Related

performSegue is not entered but no error is generated

In swift3 I have done multiple segue's but in my latest one when I do one:
self.performSegue(withIdentifier: "registrationSettions", sender: self)
where registrationSettings is a "show" segue to my RegistrationViewController class.
In xcode 8 it just steps over the performSegue call without doing a transition into the view controller code (I have a break point in it in the viewDidLoad (first line) and it isn't reached). And no errors are generated to the system console.
I have over 15 other classes where doing segue's work just fine. So my question is under what cases can performSegue be used where the view controller isn't entered and no errors are generated in the system console? I know that the segue specified is correct because I have tried spelling it incorrectly and I get an error in the system console. I have also used a segue link to a view controller that works and the transition works fine.
I have deleted and re-added the view controller and deleted and re-added the structure for it in the Storybook and it still acts the same.
I can add the code but I don't know how I would show the Storybook structure. But it still comes back to why the performSegue call is stepped through in Xcode without transitioning into the view controller code and no errors are generated to the system window.
Has anyone seen this behavior? I have done several days of surfing and haven't found anyone who gets this behavior. Usually it results in errors in the system console.

Cocos2d iAd banner appearing v3

I am following this iAd banner tutorial Cocos2d_iAd_v3 and it works. I am now trying to get rid of the button that toggle the "Show banner" and "Hide banner" and only show the iAd banner only; however it doesn't seem to work.
How can I display the iAd banner without using the button to turn it on and off?
Thanks
The iAd network is sending ads continuously, so as long as the banner view is visible (i.e. is placed in a visible region of the screen), you're going to see the banner and the ads always. Therefore, if during the initialization of the game (e.g. in AppDelegate) you create the banner view object, it should be there forever. However, you must consider hiding the banner view if an ad is not loaded, which you can check with the property "bannerLoaded" property.
I recently posted an entry in my blog on integrating iAd and Cocos2d. You might want to give it a read.

Show Message Bar in ribbon mfc

Probabbly i am not sure what to search for ... But the idea is to display a message bar bellow ribbon control. When user try to edit a read only file. I don't want user to click on OK to remove error message. Thats why i can't use MessageBox.
Status bar doesn't seem right place to display error messages.
Which control i should start exploring.
MSOffice normally displays such message when user opens files in protected view .
I don't want you to do research for me, I just want the right direction i will do the rest.
Thanks
You can easily use CMFCCaptionBar for such an attempt. When you create a ribbon bar SDI application you get sample code for free.
Also it is possible to hide and Show such a bar on the fly with ShowWindow. Also this code is generated by the wizard.

Returning to my app after navigation

As suggested in other posts I used the following code to start navigation from my GDK application. When the user finishes navigating they go back to the main "Ok Glass" screen. Is there any way to bring the user back to my app?
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("google.navigation:q="+lat+","+lon));
startActivity(intent);
This is untested, but can you try adding the following flag to your intent and see if it changes the behavior?
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

cocos2dx OpenGL error 0x0506 when dismissing UIViewController

I've run into very difficult issue. In the Cocos2d-x game i'm working upon currently (it's main part is written by another developer i'm just finishing it, and by now it is supposed to work on iOS only so i don't care about all the Android related stuff ) i need to use UIViewController. I present it and dismiss in a very usual way:
present:
SDMoreAppsViewController *vc = [[SDMoreAppsViewController new] autorelease];
[viewController presentViewController:vc animated:NO completion:nil];// viewController is UIWindow root view controller
dismiss:
UIViewController *controller = self.presentingViewController;
[controller dismissViewControllerAnimated:NO completion:nil];
Once the view controller is successfully dismissed i see the message in my console telling me that opengl error 0x0506 has appeared. This message is printed from methods swapBuffers of EAGLView and draw of CCSprite. Along with this message my whole scene becomes unresponsive. Tapping buttons gives no result.
I've tried a lot of things already. I tried pushing my view controller and adding it as a child instead of presenting but it doesn't even shows the view controller (viewWillAppear method doesn't get called), i also tried adding its view as a subview to my app's window but that also brings a lot of different errors.
I'm using cocos2d-x version cocos2d-2.1rc0-x-2.1.3.
Did someone solve such a problem before? Any suggestions?
before presentViewController, pause rendering:
CCDirector::sharedDirector()->pause();
CCDirector::sharedDirector()->stopAnimation();
call resume and startAnimation in completion block