Adding iAds in Enterprise - which view to add?

Hi,

I am trying to add iAds to my app…
I added the iAd Framework to my project and imported iAd/ADBannerView.h as well…

I have this code to create a ADBannerView object
[cpp]
ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, 0, -50);
[self.view addSubview:adView];
adView.delegate=self;
[super viewDidLoad];
[/cpp]

Now after creating an object of ADBannerView, there is this line [self.view addSubview:adView];… My understanding is that views in iOS are somewhat analogous to what activities are in Android. Please correct me if I am wrong… So the above line just adds the banner view to the existing view,right?

My question is how do I know which is the existing view when the app is being run?? I mean is there some way I can access the view object?

Hope I made sense. I am very knew to Objective C so please forgive the noobness of the question :slight_smile: [import]uid: 64174 topic_id: 34084 reply_id: 334084[/import]

I tried getting the ViewController by the folllowing 2 codes…
[cpp]
MyCoronaDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
UIView *view = appDelegate.viewController.view;
[/cpp]
and
[cpp]
MyCoronaDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
UIView *view = appDelegate.navigationController.topViewController.view;
[/cpp]

Both threw up errors… apparently appDelegate did not have navigationController or viewController property… Some help here guys!! [import]uid: 64174 topic_id: 34084 reply_id: 135533[/import]

Hi Satheesh,

In order to know which existing view is displayed in the appDelegate, the delegate would have to have a root controller. However the Corona delegate does not.

In order to add support for iAds to your enterprise application, please check out the ads-provider project template located in the CoronaEnterprise\ProjectTemplates\ads-provider folder.

Hope this helps,

Alex. [import]uid: 196533 topic_id: 34084 reply_id: 135612[/import]

@Alex There is no folder ‘ProjectTemplates’ in my CoronaEnterprise Folder…
The only contents of the folder are
[text]
Android
iOS
CoronaBuilder.app
Readme.html
style.css
[/text] [import]uid: 64174 topic_id: 34084 reply_id: 135618[/import]

Satheesh - I believe the trial build you have is one from just before the Providers stuff was added in. I’ll put a newer build in the dropbox folder I shared with you.

David [import]uid: 10668 topic_id: 34084 reply_id: 135642[/import]

I tried getting the ViewController by the folllowing 2 codes…
[cpp]
MyCoronaDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
UIView *view = appDelegate.viewController.view;
[/cpp]
and
[cpp]
MyCoronaDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
UIView *view = appDelegate.navigationController.topViewController.view;
[/cpp]

Both threw up errors… apparently appDelegate did not have navigationController or viewController property… Some help here guys!! [import]uid: 64174 topic_id: 34084 reply_id: 135533[/import]

@David Thanks for the upate… The new folder organization looks neat!

But I haven’t been able to run even 1 of the apps… I tried running

CoronaEnterprise/ProjectTemplates/ads-provider/ios/AdsTestApp.xcodeproj

. On building I get the error
[text]
/Applications/CoronaEnterprise/ProjectTemplates/ads-provider/ios/Plugin/IOSMyAdsProvider.h:11:10: ‘Coronacode.h’ file not found
[/text]
The same goes for

CoronaEnterprise/ProjectTemplates/analytics-provider

and

CoronaEnterprise/ProjectTemplates/App

When I run

CoronaEnterprise/Samples/CustomErrorHandler/ios/CustomErrorHandler.xcodeproj

, I get the following errors…
[text]/Applications/CoronaEnterprise/Samples/CustomErrorHandler/ios/CoronaEnterprise/Corona/ios/resource/MainWindow-iPad.xib
/Applications/CoronaEnterprise/Samples/CustomErrorHandler/ios/CoronaEnterprise/Corona/ios/resource/MainWindow-iPad.xib: Interface Builder could not open the document “MainWindow-iPad.xib” because it does not exist.

/Applications/CoronaEnterprise/Samples/CustomErrorHandler/ios/CoronaEnterprise/Corona/ios/resource/MainWindow.xib
/Applications/CoronaEnterprise/Samples/CustomErrorHandler/ios/CoronaEnterprise/Corona/ios/resource/MainWindow.xib: Interface Builder could not open the document “MainWindow.xib” because it does not exist.

(null): error: /Applications/CoronaEnterprise/Samples/CustomErrorHandler/ios/CoronaEnterprise/Corona/ios/resource/FBDialog.bundle: Not a directory[/text]
What am I doing wrong? The projects worked well with Enterprise version 971. [import]uid: 64174 topic_id: 34084 reply_id: 135856[/import]

Which version are you using? I just pulled 988 and it works fine.

Make sure you install CoronaEnteprise in the correct folder. By default, we assume it should be in /Applications. The updated README.html explains this in more detail.

Also as a side note: for old projects, you have to migrate to the new project format. We recommend you start by copying the project template called “App” and migrating your sources over. [import]uid: 26 topic_id: 34084 reply_id: 135860[/import]

Hi Satheesh,

In order to know which existing view is displayed in the appDelegate, the delegate would have to have a root controller. However the Corona delegate does not.

In order to add support for iAds to your enterprise application, please check out the ads-provider project template located in the CoronaEnterprise\ProjectTemplates\ads-provider folder.

Hope this helps,

Alex. [import]uid: 196533 topic_id: 34084 reply_id: 135612[/import]

@Alex There is no folder ‘ProjectTemplates’ in my CoronaEnterprise Folder…
The only contents of the folder are
[text]
Android
iOS
CoronaBuilder.app
Readme.html
style.css
[/text] [import]uid: 64174 topic_id: 34084 reply_id: 135618[/import]

Satheesh - I believe the trial build you have is one from just before the Providers stuff was added in. I’ll put a newer build in the dropbox folder I shared with you.

David [import]uid: 10668 topic_id: 34084 reply_id: 135642[/import]

@David Thanks for the upate… The new folder organization looks neat!

But I haven’t been able to run even 1 of the apps… I tried running

CoronaEnterprise/ProjectTemplates/ads-provider/ios/AdsTestApp.xcodeproj

. On building I get the error
[text]
/Applications/CoronaEnterprise/ProjectTemplates/ads-provider/ios/Plugin/IOSMyAdsProvider.h:11:10: ‘Coronacode.h’ file not found
[/text]
The same goes for

CoronaEnterprise/ProjectTemplates/analytics-provider

and

CoronaEnterprise/ProjectTemplates/App

When I run

CoronaEnterprise/Samples/CustomErrorHandler/ios/CustomErrorHandler.xcodeproj

, I get the following errors…
[text]/Applications/CoronaEnterprise/Samples/CustomErrorHandler/ios/CoronaEnterprise/Corona/ios/resource/MainWindow-iPad.xib
/Applications/CoronaEnterprise/Samples/CustomErrorHandler/ios/CoronaEnterprise/Corona/ios/resource/MainWindow-iPad.xib: Interface Builder could not open the document “MainWindow-iPad.xib” because it does not exist.

/Applications/CoronaEnterprise/Samples/CustomErrorHandler/ios/CoronaEnterprise/Corona/ios/resource/MainWindow.xib
/Applications/CoronaEnterprise/Samples/CustomErrorHandler/ios/CoronaEnterprise/Corona/ios/resource/MainWindow.xib: Interface Builder could not open the document “MainWindow.xib” because it does not exist.

(null): error: /Applications/CoronaEnterprise/Samples/CustomErrorHandler/ios/CoronaEnterprise/Corona/ios/resource/FBDialog.bundle: Not a directory[/text]
What am I doing wrong? The projects worked well with Enterprise version 971. [import]uid: 64174 topic_id: 34084 reply_id: 135856[/import]

Which version are you using? I just pulled 988 and it works fine.

Make sure you install CoronaEnteprise in the correct folder. By default, we assume it should be in /Applications. The updated README.html explains this in more detail.

Also as a side note: for old projects, you have to migrate to the new project format. We recommend you start by copying the project template called “App” and migrating your sources over. [import]uid: 26 topic_id: 34084 reply_id: 135860[/import]