为什么得到“Objective-C方法的预期选择器”错误

时间:2013-09-02 04:07:21

标签: objective-c

我有这段代码:

@class GADBannerView,GADRequest;

@interface BT_viewController : UIViewController <UIAlertViewDelegate, 
                                                ADBannerViewDelegate,
                                                UIAccelerometerDelegate,
                                                MFMailComposeViewControllerDelegate,
                                                MFMessageComposeViewControllerDelegate,
                                                GADBannerViewDelegate>{
    BT_item *screenData;
    UIView *progressView;
    GADBannerView *bannerView_;
    /* iAd Views */
    UIView *adView;
    ADBannerView *adBannerView;
    BOOL adBannerViewIsVisible;
    BOOL hasStatusBar;
    BOOL hasNavBar;
    BOOL hasToolBar;

}



@property (nonatomic, retain) BT_item *screenData;
@property (nonatomic, retain) UIView *progressView;
@property (nonatomic, retain) UIView *adView;
@property (nonatomic, retain) ADBannerView *adBannerView;
@property (nonatomic) BOOL adBannerViewIsVisible;
@property (nonatomic) BOOL hasStatusBar;
@property (nonatomic) BOOL hasNavBar;
@property (nonatomic) BOOL hasToolBar;

-(id)initWithScreenData:(BT_item *)theScreenData;


-(void)showProgress;
-(void)hideProgress;
-(void)navLeftTap;
-(void)navRightTap;
-(void)showAudioControls;
-(void)showAlert:(NSString *)theTitle theMessage:(NSString *)theMessage alertTag:(int)alertTag;
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;

//iAd methods...
-(void)createAdBannerView;
-(void)resizeAdView;
-(void)showHideAdView;
-(void)bannerViewDidLoadAd:(ADBannerView *)banner;
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error;

//shake capture...
-(void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event;

//message compose delegate methods...
-(void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result;
-(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error;



//rotation methods...
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;

@property(nonatomic, strong) GADBannerView *bannerView;
- {GADRequest *}createRequest;

@end

我不知道为什么在这一行:

- {GADRequest *}createRequest;

它给出了一个错误:“Objective-C方法的预期选择器” 但是如果我删除那些行以上的代码就可以了。 你能弄明白这里的错误是什么吗?抱歉,因为我是新手,我对这个错误信息的含义感到很困惑。 谢谢。

1 个答案:

答案 0 :(得分:4)

我相信你正在尝试声明一个实例方法。改变如下。

- (GADRequest *)createRequest; //To This

- {GADRequest *}createRequest; //From this