Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSGetSizeAndAlignment(): unsupported type encoding spec #3

Closed
niklassaers opened this issue Apr 15, 2016 · 7 comments
Closed

NSGetSizeAndAlignment(): unsupported type encoding spec #3

niklassaers opened this issue Apr 15, 2016 · 7 comments

Comments

@niklassaers
Copy link

Hi guys,

In my mixed Swift/ObjC project, I copy/pasted the instructions under "Example usage" into a ObjC file. At

NSSet *retainCycles = [detector findRetainCycles];

I got an objc_exception

NSGetSizeAndAlignment(): unsupported type encoding spec 'b' at 'b2' in 'b2'

from FBClassStrongLayout.m line 43.

I use FBRetainCycleDetector (0.1.1) via CococaPods (with frameworks enabled)

@Gricha
Copy link

Gricha commented Apr 15, 2016

Hey! Interesting, in general some types are unavailable to query for (for example if you have a struct and this struct has bitfields at the beginning and some objects at the end, we wouldn't cover that).
Because NSGetSizeAndAlignment() can throw we have wrapped that in @try-catch block.

So that's the idea - the question is - why the exception was not caught. Frameworks might be to blame, I'll look into it a little bit more.

@Gricha
Copy link

Gricha commented Apr 15, 2016

Are you in debug mode? There is a good chance you are not crashing but are stopping in exception breakpoint. Could you try disabling this and check if the issue is still happening for you?

@kastiglione
Copy link
Contributor

Yes, the 'b' is _C_BFLD, a bitfield.

Since there's some encoding parsing going on, I wonder if there should be a black list of known bad types, like bitfields, to avoid going down a path that is sure to fail.

@Gricha
Copy link

Gricha commented Apr 15, 2016

That is a good point. Especially that, IIRC, throwing and catching exception is not exactly "free" :P

Maintaining short check-list before falling in might be a good thing for performance, the question is if it's cheaper to sometimes throw & catch, or constantly do a lookup in every ivar check.

Thoughts?

@JackLSH2016
Copy link

只是路过!

@HaloWang
Copy link

HaloWang commented May 25, 2016

In my UIViewController class, I create a property like this:
@property (nonatomic, strong) void(^aBlock)();
and I'm sure there is a retaincycle between my viewController and this property.
When I use FBRetainCycleDetector, my problem stop at FBClassStrongLayout.m line 43, with a global All Exceptions Breakpoint.
image

@Gricha
Copy link

Gricha commented May 25, 2016

Yes, NSGetSizeAndAlignment throws exception that will be caught by exception breakpoint. The safest is to turn off exception breakpoint when using retain cycle detector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants