kishikawakatsumi / JavaScriptBridge

Write iOS apps in Javascript! JavaScriptBridge provides the way to write iOS apps with JavaScript. Powered by JavaScriptCore.framework.
http://d.hatena.ne.jp/KishikawaKatsumi/20140104/1388848644
MIT License
529 stars 65 forks source link

iOS 8 support #29

Open jtreanor opened 9 years ago

jtreanor commented 9 years ago

Hi there,

Really great project :smile:

There are a few issues with getting this up and running in iOS 8.3:

ERROR: Class UIViewController exported more than one init family method via JSExport. Class UIViewController will not have a callable JavaScript constructor function.
Passing 'void (^const _strong)()' to parameter of incompatible type 'JSValue *'

It would be awesome to get this up and running on iOS 8, I'm happy to do the work but I'm just getting my head around it right now.

Do you have any idea what the cause of 1 is and why is just happens for a small set of classes?

Regarding 2, one idea I had is to replace -(instancetype)initWithX: in protocols with a factory method like +(instancetype)createWithX:. For example UIView's protocol could have the method +(instancetype)createWithFrame:(CGRect)frame and UIView+JavaScriptBridge could have:

+ (instancetype)createWithFrame:(CGRect)frame {
    return [[[self class] alloc] initWithFrame:frame];
}

What do you think of this approach? Is there an automatic way to produce the framework headers so this wouldn't all have to be done manually?

I think 3 shouldn't be a big deal.

fisherjoe commented 9 years ago

Hmm, I retrieved the same problem!