本文介绍了在启用ARC的项目中使用非ARC代码 - 添加Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我创建我的项目时,我支持 ARC ,所以我的项目将支持iOS 4.3及更高版本。

When i created my project, i made it to support ARC, so my project will support iOS 4.3 and above.

现在我需要整合Twitter和Facebook。公司提供的Facebook和Twitter框架都不支持 ARC

Now i need to integrate Twitter and Facebook to it. Both Facebook and Twitter frameworks given by the companies does not support ARC.

大多数文件都有dealloc,释放其变量。有人说要废弃项目,并重新启动ARC。但是,我不能这样做,因为我做了大部分的事情。

Most of the files have dealloc, and released its variables. Some say to scrap the project and redo it disabling ARC. But, i can't afford to do this, since i have done most of the stuff.

我添加了 FBConnect 文件(其中有4个),并添加 -fno-objc-arc ,如。仍然我得到

I added the FBConnect files (there were 4 of them) and added -fno-objc-arc as described in this tutorial. Still i get

file://localhost/Users/illepmorgan/Documents/Projects/illep/untitled%20folder/alphaproject/alphaproject/FBRequest.m: error: Automatic Reference Counting Issue: Existing ivar '_delegate' for unsafe_unretained property 'delegate' must be __unsafe_unretained

我需要帮助,我不能重做这个。

I need help, i can't redo this again.

推荐答案

确保你添加了-fno -objc-arc标志到每个实现文件(.m文件)。

Make sure that you added the -fno-objc-arc flag to each implementation file (.m file).

然后清理项目(项目菜单 - >清洁)并重新构建。在上课时,我有时不得不清理两次。似乎像一个小bug。

And then clean the project (Project menu -> clean) and build again. I have sometimes had to clean and build twice when doing this in class. Seems like a little bug.

这篇关于在启用ARC的项目中使用非ARC代码 - 添加Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 16:33