Adding extThree20JSON via command line

74 views
Skip to first unread message

Philip Walton

unread,
Dec 17, 2010, 7:25:18 PM12/17/10
to Three20
I created a new project called Test. Then I used the following two
commands to add Three20 and extThree20JSON:

> python three20/src/scripts/ttmodule.py -p Test/Test.xcodeproj -c Debug -c Release Three20

> python three20/src/scripts/ttmodule.py -p Test/Test.xcodeproj extThree20JSON:extThree20JSON+YAJL

I can build and run now, and I get no errors. However, if I try to do
something like this:

TTURLRequest* request = [TTURLRequest requestWithURL:url delegate:
self];

TTURLJSONResponse* response = [[TTURLJSONResponse alloc] init];

request.response = response;
[request send];

When I run the code, the app crashes immediately (but I get no build
errors). I'm pulling my hair out trying to figure out why this doesn't
work. If I comment out the [request send] line, it runs without
crashing, but obviously nothing is loaded.

Is there something wrong with how I'm adding the extension? Do I need
to do more than just that command?

Any help would be MUCH appreciated!

Here is the error stack in case it's helpful:

2010-12-17 16:23:40.240 Test[8207:207] -[NSConcreteMutableData
yajl_JSON]: unrecognized selector sent to instance 0x4c17c30
2010-12-17 16:23:40.244 Test[8207:207] *** Terminating app due to
uncaught exception 'NSInvalidArgumentException', reason: '-
[NSConcreteMutableData yajl_JSON]: unrecognized selector sent to
instance 0x4c17c30'
*** Call stack at first throw:
(
0 CoreFoundation 0x01040be9
__exceptionPreprocess + 185
1 libobjc.A.dylib 0x011955c2
objc_exception_throw + 47
2 CoreFoundation 0x010426fb -
[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00fb2366 ___forwarding___ +
966
4 CoreFoundation 0x00fb1f22
_CF_forwarding_prep_0 + 50
5 Test 0x000ac1f7 -
[TTURLJSONResponse request:processResponse:data:] + 319
6 Test 0x0007c981 -[TTRequestLoader
processResponse:data:] + 265
7 Test 0x0008642d -
[TTURLRequestQueue(TTRequestLoader) loader:didLoadResponse:data:] +
105
8 Test 0x0007d842 -[TTRequestLoader
connectionDidFinishLoading:] + 211
9 Foundation 0x002eb172 -
[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading]
+ 108
10 Foundation 0x002eb0cb
_NSURLConnectionDidFinishLoading + 133
11 CFNetwork 0x017ef606
_ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE
+ 220
12 CFNetwork 0x018ba821
_ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl
+ 293
13 CFNetwork 0x018bab0f
_ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl
+ 1043
14 CFNetwork 0x017e5e3c
_ZN19URLConnectionClient13processEventsEv + 100
15 CFNetwork 0x017e5cb7
_ZN17MultiplexerSource7performEv + 251
16 CoreFoundation 0x0102201f
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
17 CoreFoundation 0x00f8028b
__CFRunLoopDoSources0 + 571
18 CoreFoundation 0x00f7f786 __CFRunLoopRun +
470
19 CoreFoundation 0x00f7f240
CFRunLoopRunSpecific + 208
20 CoreFoundation 0x00f7f161 CFRunLoopRunInMode
+ 97
21 GraphicsServices 0x01b4e268 GSEventRunModal +
217
22 GraphicsServices 0x01b4e32d GSEventRun + 115
23 UIKit 0x0055842e UIApplicationMain
+ 1160
24 Test 0x000abe34 main + 102
25 Test 0x000abdc5 start + 53
)
terminate called after throwing an instance of 'NSException'

Philip Walton

unread,
Dec 17, 2010, 8:11:13 PM12/17/10
to Three20
OK, I figured out a way to fix this issue, and I thought others might
like to know.

Setting just "-all_load" and "-ObjC" in the "Other Linker Flags"
prevented the crash and the error, but I'm still confused as to why.

Perhaps there's a bug in how ttmodule.py sets those options, or
perhaps it's something else. If anyone has any theories as to what's
going on, I'd love to hear them.

Jeff Verkoeyen

unread,
Dec 18, 2010, 10:15:29 AM12/18/10
to thr...@googlegroups.com
The -c flag adds configuration properties to the given target for the
library that you are adding. In your second line, you specify the
library to add, but not the configurations to modify, so the
force_load flag won't be added for the JSON library. This is why your
symbols don't get linked for the JSON lib and why all_load appears to
fix the problem.

This is a fair point of confusion about the script though. What if I
make it so that, by default, without providing a -c flag, the Debug
and Release configurations are assumed? Then, if the -c flag is
provided, only the configurations explicitly specified will be
modified!

Cheers,
- Jeff

> --
> You received this message because you are subscribed to the Google
> Groups "Three20" group.
> To post to this group, send email to thr...@googlegroups.com
> To unsubscribe from this group, send email to
> three20+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/three20?hl=en
>
> To learn more about Three20, check out
> http://Three20.info/

Philip Walton

unread,
Dec 18, 2010, 1:38:30 PM12/18/10
to thr...@googlegroups.com
Thank you, Jeff!

That makes perfect sense, and using the script with the -c flag fixed my issue.

To your point about the confusion: after looking back at the examples and options the command line prints out, it does seem rather obvious that you would need to use the -c flag. However, the example for extThree20JSON:extThree20JSON+SBJSON didn't include any usage of the -c flag, which is why I didn't think to try it (I just copied and pasted). Also, since I'm relatively new to Xcode, the words Debug and Release didn't jump out at me as configurations I needed to pay attention to.

Moving forward, I do think it would make sense to only use the -c flag if you wanted to specifically use certain configurations, and have no -c flag imply all configurations. That way, novice users would be less likely to encounter problems, and advanced users could still configure their projects exactly how they wanted them.

Phil
Reply all
Reply to author
Forward
0 new messages