Active Record throws NSInvalidArgumentException on Device
-
Fjölnir Ásgeirsson
- Assigned user set to Fjölnir Ásgeirsson
- State changed from new to resolved
- Tag set to iphone
Hi, this is because the iPhone, doesn't implement -className. I've written a workaround for this and it's in the repository :) Downloading the latest version of active record should fix it. If not, please submit a comment on this ticket and I'll reopen it. (Maybe attaching your project)
-
Fjölnir Ásgeirsson
Turns out, I made a stupid error in my iphone workaround and you were completely right! I've fixed it and now it should work fine ;)
-
Leicester
There is no new version on github...
-
Fjölnir Ásgeirsson
Actually, I committed my changes about 3 minutes before posting my reply :) Just download the source again and you'll get the changes
If you're using an old version of the iPhone template, you'll need to drag NSObject+iPhoneHacks.h & NSObject+iPhoneHacks.m into your project for the workarounds to be included.
-
Andy Blackwell
This may need revisiting. The only way I got activerecord to not crash in the simulator was by deleting the if statements that prevented these hacks from being added if build target was the simulator. Everything worked fine with them included.
Using
MAC OSX 10.6.2
iPhone Simulator 3.1.2
activerecord masterdeleted this if statement where I found it
if (TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR)
-
Andy Blackwell
possibly just refactor to replace all
[self className]
with
NSStringFromClass([self class])
instead of the hacks
-
Fjölnir Ásgeirsson
- State changed from resolved to open
well that's what NSObject (iPhoneHacks) does (Source/Utilities/iPhone Hacks/) try changing #if (TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR) to #if (TARGET_OS_IPHONE) and see if that makes it work.
Back when I wrote that there was an inconsistency so [NSObject className] worked in the simulator but not on the device. They may have fixed that in the newer SDKs.
If that fix works please make a patch and upload it here
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.