无法跟踪错误

时间:2011-08-29 11:25:30

标签: iphone ios error-handling advertisement

我正在尝试在应用上添加广告包。我在另一个项目上完成了它,它起作用了。但在这里,我有一个神秘的错误,从未发生过。你能帮我跟踪吗?

你能帮我跟踪一下这个错误吗?

2011-08-29 13:22:12.012 MeoCampus[45962:207] -[AdRequest initWithPageId:formatId:master:target:creator:request:requestDelegate:]: unrecognized selector sent to instance 0x633aa20
2011-08-29 13:22:12.015 MeoCampus[45962:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AdRequest initWithPageId:formatId:master:target:creator:request:requestDelegate:]: unrecognized selector sent to instance 0x633aa20'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x018925a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x019e6313 objc_exception_throw + 44
    2   CoreFoundation                      0x018940bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x01803966 ___forwarding___ + 966
    4   CoreFoundation                      0x01803522 _CF_forwarding_prep_0 + 50
    5   MeoCampus                           0x000a1e92 -[SASApi downloadAdWithFormatId:pageId:master:target:creator:timeout:] + 235
    6   MeoCampus                           0x000a7a64 -[SmartAdServerView loadFormatId:pageId:master:target:timeout:] + 401
    7   MeoCampus                           0x000a7ab3 -[SmartAdServerView loadFormatId:pageId:master:target:] + 71
    8   MeoCampus                           0x00004623 -[HomeViewController viewDidLoad] + 483
    9   UIKit                               0x00c57089 -[UIViewController view] + 179
    10  UIKit                               0x00c55482 -[UIViewController contentScrollView] + 42
    11  UIKit                               0x00c65f25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
    12  UIKit                               0x00c64555 -[UINavigationController _layoutViewController:] + 43
    13  UIKit                               0x00c65870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
    14  UIKit                               0x00c6032a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
    15  UIKit                               0x00d7b2e9 -[UILayoutContainerView layoutSubviews] + 226
    16  QuartzCore                          0x00203a5a -[CALayer layoutSublayers] + 181
    17  QuartzCore                          0x00205ddc CALayerLayoutIfNeeded + 220
    18  QuartzCore                          0x001ab0b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
    19  QuartzCore                          0x001ac294 _ZN2CA11Transaction6commitEv + 292
    20  UIKit                               0x00ba99c9 -[UIApplication _reportAppLaunchFinished] + 39
    21  UIKit                               0x00ba9e83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690
    22  UIKit                               0x00bb4617 -[UIApplication handleEvent:withNewEvent:] + 1533
    23  UIKit                               0x00bacabf -[UIApplication sendEvent:] + 71
    24  UIKit                               0x00bb1f2e _UIApplicationHandleEvent + 7576
    25  GraphicsServices                    0x02199992 PurpleEventCallback + 1550
    26  CoreFoundation                      0x01873944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    27  CoreFoundation                      0x017d3cf7 __CFRunLoopDoSource1 + 215
    28  CoreFoundation                      0x017d0f83 __CFRunLoopRun + 979
    29  CoreFoundation                      0x017d0840 CFRunLoopRunSpecific + 208
    30  CoreFoundation                      0x017d0761 CFRunLoopRunInMode + 97
    31  UIKit                               0x00ba97d2 -[UIApplication _run] + 623
    32  UIKit                               0x00bb5c93 UIApplicationMain + 1160
    33  MeoCampus                           0x000023e9 main + 121
    34  MeoCampus                           0x00002365 start + 53
)
terminate called after throwing an instance of 'NSException'

以下是制作广告的代码:

#pragma mark - View lifecycle
- (void)viewDidLoad
{
    [super viewDidLoad];

    //Intialize the SmartAdServerView object. This example is for a banner on the iPhone, you can specify any frame you want.
    //By convention, banners have a ratio aspect of 6:1 in portrait mode, so if you have borders in your application, you should adapt the ad's height. The creative will be adapted to your view's frame, but it will look better if they have the same size.
    //The iPad recommended height, with a 6:1 ratio is 128 pixels 
    SmartAdServerView *banner = [[SmartAdServerView alloc] initWithFrame:CGRectMake(.0,315.0,320.0,53.0) loader:SmartAdServerViewLoaderActivityIndicatorStyleWhite];


    //Set an auto-resizing mask, for the view to adapt it's size when it's superview is resized (after a rotation for example). Typically a banner keep it's height and adapt it's width.

    banner.autoresizingMask = UIViewAutoresizingFlexibleWidth;


    //Set the banner to stay in place, so it won't be removed automatically.

    banner.unlimited = YES;


    //Set your ad's delegate, which will be the presentator of ad's modal view to the user, and will be notified of significative events

    banner.delegate = self;
    NSLog(@"set the delegate.");

    NSLog(@"the delegate is = %@", [[banner delegate] class]);


    //Load the ad with your settings
    //The siteId can be a string in some rare cases, this is why you have to pass an NSString
    //One ad per page of your application should have the  "YES" for the "master" argument, and the other should have "NO", this is for page view counting.

    //[banner loadFormatId:12345 pageId:@"98765" master:YES target:nil];

    //Display the ad to the user, here we assume that we are in a UIViewController

    [self.view addSubview:banner];
    self.myAd = banner;
    [banner release];    
}

非常感谢。

2 个答案:

答案 0 :(得分:0)

在代码中搜索initWithPageId:formatId:master:target:creator:request:requestDelegate:方法。您正在为不能识别它的对象调用它。

答案 1 :(得分:0)

我联系了广告运营商。谢谢大家。