LoginSignup
2
2

More than 5 years have passed since last update.

mogeneratorでARCに対応したコードを出力する

Posted at

ARCではstructのなかに、NSString*とか、Objective-Cのメンバを入れると
ARC forbids Objective-C objects in structs or unionsと怒られます。

mogeneratorで出力する際に、 --template-var arc=true をつけると、

extern const struct HogeAttributes {
    __unsafe_unretained NSString *created_at;
    __unsafe_unretained NSString *identifier;
    __unsafe_unretained NSString *timeline_id;
    __unsafe_unretained NSString *updated_at;
    __unsafe_unretained NSString *user_id;
} HogeAttributes;

などと出力してくれるようです。

  • 参考

ARCでstructの中にObjective-Cインスタンスを入れると出るエラーの回避方法

MOGenerator clashes with ARC

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2