Oh, it is really easy to know what I am doing...
This program:
// --------------------------------- //
// Project: Test
// Start: Thursday, February 24, 2011
// IDE Version: 9.006
// SETCURRENTDIR("Media") // seperate media and binaries?
ad_animate()
FUNCTION ad_animate:
glb_BannerInit()
WHILE TRUE
PRINT "AdBanner Test", 10, 100
SHOWSCREEN
WEND
ENDFUNCTION
?IFDEF IPHONE
IMPORT "C" void glb_BannerInit()
?ELSE
FUNCTION glb_BannerInit:
DEBUG "[WIN] Banner Init (sim) \n"
ENDFUNCTION
?ENDIF
INLINE
// .h ////////////
// iAdBanner with GLB
#import "iAd/ADBannerView.h"
@interface AppViewController : UIViewController <ADBannerViewDelegate> {
ADBannerView * bannerView;
UIView * _appView;
UIWindow * _appWindow;
}
@property (nonatomic, retain) IBOutlet UIView * appView;
@property (nonatomic, retain) IBOutlet ADBannerView * bannerView;
@property (nonatomic, retain) IBOutlet UIWindow * appWindow;
- (void)createBannerView;
- (void)showBanner;
- (void)hideBanner;
- (void)changeBannerOrientation:(UIInterfaceOrientation)toOrientation;
@end
// .mm ///////////////
#import "AppViewController.h"
@implementation AppViewController
@synthesize appView = _appView;
@synthesize bannerView; // = _bannerView;
@synthesize appWindow = _appWindow;
# pragma mark -
# pragma mark View
- (void)viewDidLoad {
[super viewDidLoad];
// NSLog(@"viewDidLoad");
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
// NSLog(@"viewDidAppear");
}
//- (void)viewWillAppear:(BOOL)animated {
// NSLog(@"viewWillAppear");
// if (bannerView) {
// UIInterfaceOrientation orientation=self.interfaceOrientation;
// [self changeBannerOrientation:orientation];
// }
//}
- (void)dealloc {
[super dealloc];
}
//- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
//
// return (interfaceOrientation == UIInterfaceOrientationPortrait) | (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) | (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
//}
#pragma mark -
#pragma mark ADBanner
//- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
//if (bannerView) {
// [self changeBannerOrientation:toInterfaceOrientation];
//}
// NSLog(@"shouldAutorotate");
//}
- (void)changeBannerOrientation:(UIInterfaceOrientation)toOrientation {
if (UIInterfaceOrientationIsLandscape(toOrientation)) {
bannerView.currentContentSizeIdentifier=ADBannerContentSizeIdentifierLandscape;
self.view.frame=CGRectMake(0,0, 320, 120);
} else {
bannerView.currentContentSizeIdentifier=ADBannerContentSizeIdentifierPortrait;
self.view.frame=CGRectMake(0,0, 480, 100);
}
}
- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
NSLog(@"bannerViewDidLoad");
// self.bannerView.hidden=NO;
[self showBanner];
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
// self.bannerView.hidden=YES;
// NSLog(@"bannerView");
NSLog(@"E R R O R: '%@'",error);
// [self hideBanner];
}
- (void)createBannerView {
// NSLog(@"Banner creating...");
_appWindow = [[UIApplication sharedApplication] keyWindow];
bannerView=[[[ADBannerView alloc] init] autorelease];
bannerView.delegate=self;
self.view.frame = CGRectMake(0,0, 768, 66);
bannerView.frame=CGRectMake(0,-66, 768, 66);
bannerView.currentContentSizeIdentifier=ADBannerContentSizeIdentifierPortrait;
[self.view addSubview:self.bannerView];
[_appWindow addSubview:self.view];
[_appWindow makeKeyWindow];
// [_appWindow makeKeyAndVisible];
}
- (void)showBanner {
// NSLog(@"Show banner");
CGRect bannerFrame=bannerView.frame;
bannerFrame.origin.y=0;
[UIView beginAnimations:@"showBanner" context:NULL];
bannerView.frame=bannerFrame;
[UIView commitAnimations];
}
- (void)hideBanner {
// NSLog(@"Hide banner");
CGRect bannerFrame=bannerView.frame;
bannerFrame.origin.y=-bannerFrame.size.height;
bannerView.frame=bannerFrame;
}
#pragma mark -
#pragma mark GLB
- (void)initBanner {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
[self performSelectorOnMainThread:@selector(createBannerView) withObject:nil waitUntilDone:YES];
[pool release];
}
@end
extern "C" void glb_BannerInit() {
AppViewController * UIGlbasic;
UIGlbasic = [[AppViewController alloc] init];
[UIGlbasic createBannerView];
// [UIGlbasic release];
[UIGlbasic retain];
}
ENDINLINE
Then I press F5 in GLBasic and get this error:
_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.7.826 SN:bf7232e1 - 3D, NET
Wordcount:8 commands
compiling:
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:140:29: iAd/ADBannerView.h: No such file or directory
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:144: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:144: error: `interface' does not name a type
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:156: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:156: error: expected constructor, destructor, or type conversion before '(' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:158: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:158: error: expected constructor, destructor, or type conversion before '(' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:160: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:160: error: expected constructor, destructor, or type conversion before '(' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:164: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:166: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:168: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:170: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:176: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:188:30: AppViewController.h: No such file or directory
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:192: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:176: error: `end' does not name a type
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:196: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:198: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:198: error: `synthesize' does not name a type
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:200: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:200: error: `synthesize' does not name a type
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:212: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:222: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:248: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:290: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:310: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:312: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:322: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:328: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:338: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:374: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:382: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:392: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:414: error: expected unqualified-id before '-' token
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:418: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:426: error: stray '@' in program
C:\Users\AMpos\AppData\Local\Temp\glbasic\gpc_temp0.cpp:432: error: expected constructor, destructor, or type conversion before "extern"
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 1.2 sec. Time: 10:45
Build: 0 succeeded.
*** 1 FAILED ***
(I am at work now and have not access to any mac)