« PSIG 103 | PackageMaker | Main | BARcamp Chicago 2007 »

PSIG 104 | JS <3 ObjC

Tuesday, June 26, 2007

(What is PSIG? | PSIG 104 announcement)

Items of Interest
JS <3 ObjC

Introduced in OS X 10.4, the JavaScript-ObjC bridge is currently the only officially-supported bridge. The bridge makes it easier to work with AJAX libraries, JavaScript plugins, JSON and DOM (jquery). It also gives you access to regexes (which aren't built into Cocoa) and helps you build WebKit UIs. It's somewhat limited compared to other bridges as it was created specifically for the development of dashboard widgets (which, essentially, are just webpages made with HTML, CSS, and JS). The bridge automatically morphs over numbers, strings, and arrays, but not dictionaries.

Running JS from Objc is simple:
- [WebView stringByEvaluatingJavaScriptFromString:]

With a WebView (which can be hidden), you can call any JS from ObjC.

For security reasons, there is more resistance when calling ObjC from JS. By default, all ObjC selectors and keys are excluded from JavaScript access. You override the boolean methods isSelectorExcludedFromWebScript and isKeyExcludedFromWebScript to allow access.

Security note -- anyone can open up your package and view the JS and HTML, so it's a good idea to put the more sensitive stuff in the compiled ObjC. (However, says Wolf, f-script would get you through that, too :).)

Last weekend I was at BARCamp Chicago! Perhaps a post on that at some point...

12:04 AM

Comments

Alas, this week work has undeniably sucked out my soul. Just got your comment and was very much pressed to just start laughing hysterically at the irony of it all.

=_=

Posted by Cyn at July 10, 2007 9:02 PM

RAAAAAAAAAAAAAWR XD

o-o so I found out I CAN comment on your site. Kewlskies

Posted by Casey at July 14, 2007 2:15 AM

Not sure where my final batch of Africh quotes went, so I guess it's time for a personal dump. Quote. Dump. Only I don't have very many (funnyones) stored up, so I'll bring out some from the introspective file, as well:
-------

"If she loved me for my every capacity in every possible way, I would have only succeeded in marrying a monster."

"I'm not all there." = Not having complete presence of mind.

"So there's this girl, who, um... isn't me, of course... named Weienne, and--what are you smiling about!?"

"Whoa, dude, you wanted me to repay your kindness? Talk about forgin' my signature, man."

And then a blast from the past (real quote):

Person 1: "What are you DOING!?"
Person 2: (mysteriously:) "If you already knew, then you wouldn't have asked. ... That doesn't make sense."

-------

"the youth cocoa"? Why youth? Is there a granny version where her hair's gone cocoa? XD

Posted by Weien at July 15, 2007 4:17 PM

The wind blows in many directions, yet for some odd reason doesn't blog in many directions. O,o

RAWR.

XD

Posted by Casey at July 17, 2007 4:37 PM

Wait, wow, so Gorman's doing his own wedding registry (i.e. he's getting married)?

Posted by Weien at July 25, 2007 1:47 PM