Reputation: 125
Ok so as far as i can tell I'm getting the error when I'm calling a setter designed to fit the view into it's correct box.
_parrentViewFrame = parrentViewFrame;
self.containerView.frame = _parrentViewFrame;
self.containerView.bounds = _parrentViewFrame;
[self.containerView layoutIfNeeded];
on the layoutIfNeeded i get this error
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0xb000000000000343'
Now I've got similar code all over the app and it works just fine. I've put a symbolic break point at -[NSObject(NSObject) doesNotRecognizeSelector:]. but this doesn't really help. I still can't tell which object it's trying call length on. containerView is a simple UIView. The instance is always 0xb000000000000343, not sure if thats significant but it seems like it would be. How can I debug this problem?
Upvotes: 1
Views: 909
Reputation: 214
One of two things might be going on:
As rmaddy pointed out, you may have assigned an NSNumber
to a property that is not NSNumber
. NSString
seems like a likely candidate or an object that conforms to UILayoutSupport
.
You might be overreleasing an object and an NSNumber
is taking the place of that pointer, hence the bad selector call. If that is the case, you can turn on NSZombies, which will help you catch that overreleased object. Enable NSZombies in your scheme settings under Diagnostics.
Upvotes: 1