Objective c 为什么要“得到”;目标C方法的预期选择器“;错误
我有以下代码:Objective c 为什么要“得到”;目标C方法的预期选择器“;错误,objective-c,Objective C,我有以下代码: @class GADBannerView,GADRequest; @interface BT_viewController : UIViewController <UIAlertViewDelegate, ADBannerViewDelegate, UIAccelerometerD
@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
它给出了一个错误:“Objective-C方法的预期选择器”
但是,如果我删除了上面的代码,就可以了。
你能找出这里的错误吗?抱歉,因为我是新手,所以我对错误消息的含义很困惑。
谢谢。我相信您正在尝试声明一个实例方法。更改如下
- (GADRequest *)createRequest; //To This
- {GADRequest *}createRequest; //From this
我相信您正在尝试声明一个实例方法。更改如下
- (GADRequest *)createRequest; //To This
- {GADRequest *}createRequest; //From this
您使用了大括号而不是圆括号。我不是说这是您的问题,但我从未见过语法
-{type*}selectorName代码>之前。通常我看到的是-(type*)selectorName代码>(用括号代替大括号)。我的错!是的,我的眼睛真的有问题。谢谢你的认可。我如何才能将您的评论标记为我的答案?您使用了大括号而不是括号。我不是说这是您的问题,但我从未见过语法-{type*}selectorName代码>之前。通常我看到的是-(type*)selectorName代码>(用括号代替大括号)。我的错!是的,我的眼睛真的有问题。谢谢你的认可。我怎样才能将你的评论标记为我的答案?是的,这是正确的答案!括号是这里的问题,谢谢!是的,这是正确的答案!括号是这里的问题,谢谢!