开发者

Unable to trace an error

I'm trying to add an ad package on an app. I've done it on another project, it worked. But here I'm having a mysterious error, that never happened before. Could you help me to trace it ?

Could you help me to trace this error ?

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'

Here is the code that create the ad:

#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 v开发者_如何学Ciew 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];    
}

Thanks a lot.


I contacted the ad operator. Thanks you all.


Search for initWithPageId:formatId:master:target:creator:request:requestDelegate: method in your code. You are calling it for an object that does not recognize it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜