iAd Banner - Technical only

Previous topic - Next topic

Crivens

That's great stuff! Works brilliantly. Quick question though; how do you use the showBanner and hideBanner functions? Basically I want to start the iAd immediately but on some screens I need the real estate and want to hide it. I tried mucking about with the .mm file by adding the following to the bottom:-
Code (glbasic) Select
extern "C" void glb_ShowBanner() {
AppViewController * UIGlbasic;
UIGlbasic = [[AppViewController alloc] init];
[UIGlbasic showBanner];
// [UIGlbasic release];
[UIGlbasic retain];
}
extern "C" void glb_HideBanner() {
AppViewController * UIGlbasic;
UIGlbasic = [[AppViewController alloc] init];
[UIGlbasic hideBanner];
// [UIGlbasic release];
[UIGlbasic retain];
}

Thinking it would work like the init function, but they don't seem to do anything at all. It all compiles ok in XCode and the GLB import code looks correct, but nothing happens. I'm betting what I did is massively incorrect, so any help would be appreciated!

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

matchy

#106
 :coke: I'm thirsty.

Yes, I have left the code for hiding the banner although I haven't perfect keeping the class, which only needs to allocation and initialization once. It also needs source for detecting banner touch and app pausing which I was hesitant about when submitting to the App Store.  Have a look a trucidare's recent Bluetooth ObjC source for tips on how to call other functions after the Viewcontroller alloc and init.

Simply, I'm guessing but it should be like:
Code (glbasic) Select

extern "C" void glb_HideBanner() {
[UIGlbasic hideBanner];
}

Crivens

It looks like my original code above is firing the HideBanner function (I unremmed the NSLog line and it appears in the console), it just doesn't do much as it stands. If it makes any difference I modified the location of the iAd, using the same code you supplied, to appear at the bottom of the screen. So far though the hideBanner routine is doing the NSLog output to the console and that's about it. I've tried a few things but no luck so far.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

ampos

Here https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/wo/8.0.0.9.1.7.1.1.7.1 Apple says

QuoteCan I join the iAd Network and serve iAd advertising for my iOS 3 application?
Ads from the iAd Network can only run on iOS apps built with iOS SDK 4 and target iOS 4 as the minimum OS.

So, any iOS 4.x should open iADs apps. Do you know why it crash in all iOS but 4.2.1?

(also, I "forgot" to set my app as iOS 4 minimun, I don't know how Apple approved it...)
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

ampos

#109
As I noted before, Matchy's implkementation of iAD only works in 4.2.1, but it should on all 4.x

MSX note me that the funciton "ADBannerContentSizeIdentifierPortrait" was only in 4.2.1, and previously "ADBannerContentSizeIdentifier320x50" was used in 4.0, so I changed "...Portrait" with "...320x50" and tested in a 3GS 4.0.1, and... at least, it did not crash, but it also "does not work".

If someone can point me on the right direction, I will made more tests...
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

matchy

Hey everyone, Ampos is doing very well at implementing iAdBanners although he's need to set a weak link for the iAd framework library for backwards iOS compatibility.

http://developer.apple.com/library/ios/#recipes/XcodeRecipes/Linking_to_Libraries_and_Frameworks/Linking_to_Libraries_and_Frameworks.html

Example:

ampos

Quote from: matchy on 2011-Mar-09
Hey everyone, Ampos is doing very well at implementing iAdBanners although he's need to set a weak link for the iAd framework library for backwards iOS compatibility.

http://developer.apple.com/library/ios/#recipes/XcodeRecipes/Linking_to_Libraries_and_Frameworks/Linking_to_Libraries_and_Frameworks.html

Example:


I see... but perhaps this weak is only if you want your app to be run on 3.x iOS (without iADs), but I dont want to. If possible, I want to make it 4.x capable (a iADs are a 4.x thing), not only 4.2.1 as now.

Or maybe I am wrong...
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Moebius

#112
[EDIT]Sorry  :offtopic:[/EDIT]
On a sales point of view, it's not like people are going to upgrade specifically to run your app (if you ONLY allow 4.2.1 and higher for the use of iAds), and likewise people aren't going to downgrade to something below that just to avoid having iAds in your app.

You'd might as well allow users whose devices are less than 4.2.1 to install your app - even if its free, and will be ad free on their devices.  The worst they can do is spread knowledge of it to users who will have iAds.
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

matchy

The issue of compatibility is non-GLB related (same for pure xcode apps) and there is no point in discussing general concerns here.

ampos

Excuse me if I did sound rude.

But iADs is compatible from 4.0 upwards, but Matchy's solution is just 4.2.1 (latest). I am just asking if someone with more knowledge than me can fix it, or if it can be fixed.

Matchy has used (AFAIK) one call that is only in 4.2.1 ("ADBannerContentSizeIdentifierPortrait"), and there seems to be similar ones in 4.0 (""ADBannerContentSizeIdentifier320x50").

Sorry, guys, but everything I said you take it as an attack. And it is not.

First, I greatly appreciate Matchy and everyone else work. I will be using what you give us.

Serpent, it is not only my app that will be forced to be 4.2.1, but everyone's app that uses the current and only one (yet) solution of iADs on GLBasic. So, if it is fixed, we all will be beneficiated. I am not telling "upgrade to 4.2.1 to use my app" as it (my app) is crap. In my app description I am saying "sorry guys, but it only works in 4.2.1"

If it can be fixed to work on every 4.x iOS, I dont understand why it shouldn't, at least, did try to be fixed. But if it cant not, or there is not enough knowledge to fix it, I can (and will) live with it. I am sorry for not having enough knowledge to do it by myself.

Meanwhile, guys, again, thank you all for your work and help.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

matchy

Quote from: ampos on 2011-Mar-09
Excuse me if I did sound rude.

But iADs is compatible from 4.0 upwards, but Matchy's solution is just 4.2.1 (latest). I am just asking if someone with more knowledge than me can fix it, or if it can be fixed.

Matchy has used (AFAIK) one call that is only in 4.2.1 ("ADBannerContentSizeIdentifierPortrait"), and there seems to be similar ones in 4.0 (""ADBannerContentSizeIdentifier320x50").

Sorry, guys, but everything I said you take it as an attack. And it is not.

Ampos is still talking in third to others but not me, but all is good...no offence taken by me at least because I appreciate your persistance. It's the only way to learn and that how I did it over months and months. There's no short cut even if others know....google is your friend.

Anyhow, back to the technical stuff; ADBannerContentSizeIdentifier320x50 is depreciated so use ADBannerContentSizeIdentifierPortrait because of ipad (tested) resolution.

ampos

Matchy, there is more people on this forum with knowledge of C than you...  :nana:

As I see, to use ...portrait is only advisable if your app is universal, but if it only use standard resolution, is better to use ...320x50 for backwards compatibility.

As I see, it could better something like

IF resolution>320
   ...portrait
ELSE
   ...320x50
ENDIF

Of course, in C :)

But first we (as I am not the only one that will use this in the future!) need the <4.2.1 thing working.

Althoug, Matchy, the real question here is: do you want to make your iAD implementation 4.x compatible? If you dont, further talk is futile.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

matchy

Who cares what people know if they haven't posted in this thread, so enough of the politics please.

I'm not sure what the issue is as I have tested iAd on 3.0 to 4.2 devices and it works ok.

Again, your issue can be solved on a Cocoa/xcode forum rather than here because it has NOTHING to do with GLB.

kaotiklabs

How I should do to use it in landscape mode (in the bottom)?
I have tried without no luck.

any tip?

Thanks in advance.
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

matchy

This code is for fixed portrait only as that is how it was released for the first iAd app. For now, rotation orientation tests okay so removing the commenting from the class methods and modifying shouldAutorotateToInterfaceOrientation and willRotateToInterfaceOrientation to set the default fixed orientation.  :)