将AVAudioPlayerDelegate设置为self会给我一个警告

时间:2012-04-21 00:12:08

标签: objective-c

'__strong' only applies to objective-c object or block pointer types; type here is 'void *'

这是我的AVAudioPlayer.h文件中的“__strong”行(这是一个导入的框架)

@interface AVAudioPlayer : NSObject {
@private
    __strong void *_impl;
}

我的.h文件看起来像这样

#import <UIKit/UIKit.h>
#import <AVFoundation/AVAudioPlayer.h>

@interface excerViewController : UIViewController <AVAudioPlayerDelegate,UIAccelerometerDelegate>


@property (weak, nonatomic) IBOutlet UILabel *avgLabel;
@property (weak, nonatomic) IBOutlet UILabel *modeLabel;
@property (weak, nonatomic) IBOutlet UILabel *scoreLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UIButton *playButton;
@property int subScore;
@property int score;
@property int seconds;
@property int moments;
@property NSMutableString *average;
@property double avg;
@property BOOL locked;
@property double delta;
@property UIAccelerometer *accel;
@property AVAudioPlayer *player;
-(void)drawEnergy:(double)energy;
@end

我不能为我的生活弄清楚为什么我会收到这个错误。 StackOverflow上的另一个人有这个问题,这不是我得到它的原因 ('__strong' only applies to objective-c object or block pointer types; type here is XXX" warning

1 个答案:

答案 0 :(得分:1)

因为void *是一个指向没有类型且不是真实对象的参数的指针,__strong不适用于它。