Re: subclass overwriting superclass ivar
Re: subclass overwriting superclass ivar
- Subject: Re: subclass overwriting superclass ivar
- From: Jean-Daniel Dupas <email@hidden>
- Date: Thu, 27 May 2010 15:42:23 +0200
Le 27 mai 2010 à 13:53, email@hidden a écrit :
>
>
> On 26 May 2010, at 20:00, Greg Parker wrote:
>>>
>>
>> Mac or iPhone?
>> iPhone device or iPhone simulator?
>> 32-bit Mac or 64-bit Mac?
>>
> Sorry for the vagueness. 32 bit mac.
>
>> My guess is that (1) you're running on iPhone Simulator or 32-bit Mac, and (2) you recently added an ivar to MGS_A but did not recompile all code that uses MGS_B. In that case, any MGS_B code that was compiled with the old declaration of MGS_A will think MGS_A is smaller than it actually is, and write its ivar values to the wrong place.
>>
>> Try a clean rebuild of everything. If the above is the problem, a clean build should fix it.
> A clean build does sort it out.
>
> I am astonished that I don't fall over this simple issue every day.
>
> MGS_A and MGS_B exist in the same module (a private framework).
> If I add an ivar to MGS_A and build my app then MGS_B succumbs to the fragile ivar syndrome.
> I have to touch MGS_B and rebuild in order to update its ivar offsets.
> I always presumed that as MGS_B is a subclass of MGS_A it would get built too.
>
> Is there no build support to help with these sorts of class dependencies?
> Or have I borked my build settings somewhere?
If MGS_B is a subclass of MGS_A , it must import the MGS_A header file (else the compiler will complain).
If you touch a header file, all files that include it should be automatically rebuild on the next build, else this is a bug in Xcode that failed to properly resolve file dependencies.
If you manage to reproduce the issue, fill a radar.
WFIW, a known case where Xcode failed to properly compute dependencies is when you import your header using a macro
#define MYHEADER(header) <Framework/header.h>
#include MYHEADER(MGS_A.h)
-- Jean-Daniel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden