Skip to content

styleSheetFromSourceやstyleSheetFromFilePathがエラー #4

@shida

Description

@shida

日本語で恐縮です。

app/pixate_code.rb にある、styleSheetFromSource メソッドを VIewControllerなどから利用すると、

Objective-C stub for message `styleSheetFromSource:withOrigin:' type `@@:@i' not precompiled. Make sure you properly link with the framework or library that defines this message.

といったエラーが出てしまいます。

ですが、REPLからstyleSheetFromSourceを呼び出すのは問題ありません。
styleSheetFromFilePath も同様のエラーになってしまいます。

海老沢さんにヘルプをお願いした所、以下のように教えてくださいました。

原因としては生成される bridgesupport ファイルがまずいそうです。

Pixate の Framework に含まれるヘッダファイルを見てみましたが、PXEngine.h に以下のようにあり、

+ (id)styleSheetFromSource:(NSString *)source withOrigin:(PXStylesheetOrigin)origin;

withOrigin の引数は実は定数(enum)なので PXEngine.framework.brigesupport には以下のように吐き出されてほしいところ

ソース 1
<method class_method='true' selector='styleSheetFromFilePath:withOrigin:'>
<arg name='filePath' declared_type='NSString*' index='0' type='@'/>
<arg name='origin' declared_type='int' index='1' type='i'/>
<retval declared_type='id' type='@'/>
</method>

2つ目の引数がオブジェクトを受け取るように定義されてしまっています。

ソース2
<method class_method='true' selector='styleSheetFromFilePath:withOrigin:'>
<arg name='filePath' declared_type='NSString*' index='0' type='@'/>
<arg name='origin' declared_type='id' index='1' type='@'/>
<retval declared_type='id' type='@'/>
</method>

PXEngine.framework.brigesupport の該当箇所をソース1のように手動で書き換えると、とりあえず意図通り動くようになります。
ともあれ、RubyMotion の (というより、/usr/bin/gen_bridge_metadata のバグか仕様) によるものだと思われます。

とのことです。

RubyMotion-Pixateの範疇ではないのかもしれませんが、
watsonさんもいらっしゃるので、まずはコチラで報告させていただきました。

どうぞ、よろしくお願いします。m(_ _)m

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions