我在xCode中執行了「構建和分析」並獲得了「空指針的解引用」。我在下面的代碼中註明了哪一行是我收到的消息。我正在開發iPhone。空指針取消引用,警告
「PDFScrollView.h」
#import "ENsightAppDelegate.h"
@interface PDFScrollView : UIScrollView <UIScrollViewDelegate> {
ENsightAppDelegate *appDelegate;
}
@end
「PDFScrollView.m」
- (id)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame])) {
// Set up the UIScrollView
self.showsVerticalScrollIndicator = NO;
self.showsHorizontalScrollIndicator = NO;
self.bouncesZoom = YES;
//self.decelerationRate = UIScrollViewDecelerationRateFast;
self.delegate = self;
[self setBackgroundColor:[UIColor grayColor]];
self.maximumZoomScale = 5;//200
self.minimumZoomScale = 0.5;//.85
self.userInteractionEnabled = YES;
self.delaysContentTouches = YES;
self.canCancelContentTouches = NO;
}
appDelegate =(ENsightAppDelegate *) [[UIApplication sharedApplication] delegate];
pdfView=[appDelegate GetLeaveView];
[self addSubview:pdfView];
return self;
}
這不是完整的代碼,粘貼什麼,我認爲是非常有用的。
我覺得這很奇怪。我怎麼得到這個消息?
謝謝您的回答。它的第一次嘗試工作 – 2012-01-02 07:24:50