簡體   English   中英

iOS 7將32位移植到64位崩潰

[英]iOS 7 porting 32 bit to 64 bit Crash

為什么此代碼會導致64位崩潰? -可以正常使用32位。

它正在為UIView加載筆尖

- (id) awakeAfterUsingCoder:(NSCoder*)aDecoder {

    BOOL theThingThatGotLoadedWasJustAPlaceholder = ([[self subviews] count] == 0);

    if (theThingThatGotLoadedWasJustAPlaceholder) {

        ALTimelineView* theRealThing = [[self class] loadFromNib];

        // pass properties through
        theRealThing.frame = self.frame;
        theRealThing.autoresizingMask = self.autoresizingMask;
        theRealThing.alpha = self.alpha;
        theRealThing.hidden = self.hidden;

        [theRealThing internalInit];

        // convince ARC that we're legit
        CFRelease((__bridge const void*)self);
        CFRetain((__bridge const void*)theRealThing);

        return theRealThing;
    }
    return self;
}

loadFromNib

+ (id) loadFromNib {

    NSString* nibName = NSStringFromClass([self class]);
    NSArray* elements = [[NSBundle mainBundle] loadNibNamed:nibName owner:nil options:nil];

    for (NSObject* anObject in elements) {
        if ([anObject isKindOfClass:[self class]]) {
            return anObject;
        }
    }
    return nil;
}

我收到的錯誤是EXC_BAD_ACCESS(代碼= EXC_I386_GPFLT)

EXC_I386_GPFLT肯定是指“常規保護錯誤”,這是x86告訴您“您做了不允許做的事情”的方式。 通常,這並不意味着您訪問了內存范圍之外,但可能是您的代碼超出了范圍,並導致使用錯誤的代碼/數據,從而導致某種形式的保護違規。

檢查此參考鏈接以獲得EXC_I386_GPFLT的良好解釋

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM