Как мне получить приложение, в котором iAds можно будет запускать на iPhone 2G? Я понимаю, что это устройство не поддерживает iAds, поэтому я бы хотел, чтобы код не выполнялся.
Вот часть моего кода. Файл .h:
#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
...
В файле .m я закодировал все iAd следующим образом:
#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
Однако я все равно получаю сообщение об ошибке. Приложение всегда вылетает и отображает только загрузочную заставку. Я получаю всплывающее окно с сообщением: «Ошибка при запуске исполняемого 'приложения' Ошибка при запуске удаленной программы: не удалось получить задачу для процесса 411.» Вот консоль:
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