热电偶和ARC在XCode 4.6 [英] Mogenerator and ARC in XCode 4.6

查看:130
本文介绍了热电偶和ARC在XCode 4.6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始将mogenerator与Core Data集成到一个应用程序项目中,按照建议作为最佳实践。我添加了以下构建脚本,带有支持ARC的标志。

I am just getting started with integrating mogenerator into an app project with Core Data, per recommendations as a best practice. I added the following build script, with a flag to support ARC.

mogenerator -m FavesDataModel.xcdatamodeld/FavesDataModel.xcdatamodel --template-var arc=true

脚本成功构建了所有必需的类和子类。当时,我将所有生成的文件复制到我的项目中。最初,我得到了一个干净的成功建设。但是,当尝试另一个构建(没有做任何更改),它失败,并出现以下ARC错误:

The script successfully builds all the necessary classes and subclasses. At that time, I copied all the generated files into my project. Initially, I got a clean successful build. However, when trying another build (without making any changes), it fails with the following ARC error:

ARC forbids Objective-C objects in structs or unions

在使用下划线生成的文件中出现错误。有趣的是,当构建脚本生成如下文件时:

The errors occur in the files generated with an underscore. Interestingly, when the build script builds the files as follows:

extern const struct FavoriteAttributes {
    __unsafe_unretained NSString *maxCFS;
    __unsafe_unretained NSString *maxFeet;
    __unsafe_unretained NSString *minCFS;
    __unsafe_unretained NSString *minFeet;
    __unsafe_unretained NSString *stationIdentifier;
    __unsafe_unretained NSString *stationRealName;
    __unsafe_unretained NSString *stationState;
} FavoriteAttributes;

但是,成功构建后,XCode会删除__unsafe_unretained属性。

However, after a successful build, XCode removes the __unsafe_unretained attribute.

使用mogenerator与ARC是否存在已知问题?任何想法的解决方案或解决方法?谢谢! V

Are there known issues with using mogenerator with ARC turned on? Any ideas of a solution or workaround? Thanks! V

推荐答案

尝试从构建脚本中删除--template-var arc = true。

Try removing --template-var arc=true from your build script.

然后在XCode,Project Properties,Compile sources中,设置问题文件具有以下标志

Then in XCode, Project Properties, Compile sources, set the problem files to have the following flag

fno-objc-arc

这将只关闭这些文件的ARC。

This will turn off ARC for only those files.

这篇关于热电偶和ARC在XCode 4.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆