How can I have an application that has iAds be able to run on an iPhone 2G. I understand that this device doesn't support iAds therefore I would want the code not to be executed.
Here is some of my code. The .h file:
#import <UIKit/UIKit.h>
#ifdef __IPHONE_4_0
#import <iAd/iAd.h>
#endif
@interface ViewController : UIViewController
#ifdef __IPHONE_4_0
<ADBannerViewDelegate>
#endif
{
#ifdef __IPHONE_4_0
ADBannerView *adView;
#endif
...
In the .m file I have all iAd coded surrounded like so:
#ifdef __IPHONE_4_0 //iAd Code
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, 0, 500);
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
[self.view addSubview:adView];
adView.delegate = self;
self.bannerIsVisible = NO;
#endif
However I still get an error. The app always crashes and will only show the startup image. I get a popup saying, "Error Starting Executable 'app' Error launching remote program: failed to get the task for process 411." Here is the console:
GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Thu Jan 27 08:40:30 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin --target=arm-apple-darwin".tty /dev/ttys000
warning: Unable to read symbols from "iAd" (not yet mapped into memory).
target remote-mobile /tmp/.XcodeGDBRemote-6877-41
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none