您的位置:首页 > 移动开发 > Cocos引擎

Cocos2d开发之如何在Cocos2d项目中启用ARC机制(Build the cocos2d code as a Static Libary)

2012-11-08 02:05 369 查看
1.locate and delete the libs group in the Navigation area(Remove but not trash the libs group from the project)



2.Select the Project itself in the Nevigation area, then click the Add Target button at the bottom



3.navigate to the Framework & Librarygroup and select Cocoa Touch Static Library. Then click Next.



4.Name the static library appropriately—for example, cocos2d-library would
be a good name.Besure to deselect both Include Unit Tests and Use Automatic Reference Counting.



5.Set the Always Search User Paths setting to Yesand set the User Header Search Paths to the somewhat cryptic ./** string.



6.Select the Build Phases tab and expand the Link Binary With Libraries list.



7.Click the small + button below the list to bring up the selection dialog shown in Figure down.From
that, select the libcocos2d-library.a entry and click Add.



8.Click File  Add
Files to“name-of-project” to bring up the file dialog shown in Figure down



9.Locatethe cocos2d-library.h and cocos2d-library.m files
in the navigation area and delete the files.It’s just an empty stub class that Xcode always creates when adding a static library target.

10.From the Xcode menu choose EditRefactorConvert to Objective-C ARC.... This brings upthe dialog shown in Figure down, where
you can select the targets to convert. Select only yourapp’s target and not the cocos2d-library target. Then click Check.



11.Read the text and click Next. The dialog shown in Figure down allows
you to reviewthe changes it is about to make. You can safely accept them all by clicking Save.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: