Objective-C:如何制定框架? [英] Objective-C: How to make a Framework?

查看:105
本文介绍了Objective-C:如何制定框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Objective-C的新手,但是在Java和.NET方面有丰富的经验.

I'm new to Objective-C but has a lot experience with Java and .NET.

我正在尝试将 EGOPhotoViewer 添加到Xcode 4.2.1中的我的iOS 5项目中.但是由于我使用的是自动引用计数(我认为!),所以在编译它们的代码时会遇到很多释放,释放,保留等问题.

I'm trying to add EGOPhotoViewer to my iOS 5 project in Xcode 4.2.1. But I get a lot of release, dealloc, retain etc. issues while compiling their code, since I'm using Automatic Reference Counting (I think!).

我如何创建一个类库,框架或在Objective C中为其代码所调用的东西,我可以将其添加到我的项目中?

How can I create a class library, framework or what it is called in Objective C for their code, that I can add to my project?

我通过将代码插入一个新目标来完成JeremyP的方法.我在一开始就进行了编译,但是过了一会儿我得到了这个编译错误:

I've done the approach from JeremyP by inserting the code with a new target. I compiled in the beginning, but after a while I get this compile error:

Undefined symbols for architecture i386:
  "_OBJC_METACLASS_$_EGOPhotoViewController", referenced from:
      _OBJC_METACLASS_$_PhotoViewController in PhotoViewController.o
  "_OBJC_CLASS_$_EGOPhotoViewController", referenced from:
      _OBJC_CLASS_$_PhotoViewController in PhotoViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

有人知道为什么吗?

推荐答案

您无法为iOS创建框架.但是,您可以使用铍技术创建静态库.您还可以使用File / New / New Target...将静态库添加到现有项目中.显然,一旦创建了目标,就可以将新目标的 Objective-C自动引用计数构建设置更改为"no".

You can't create frameworks for iOS. You can however, create static libraries using beryllium's technique. You can also add a static library to your existing project using File / New / New Target... Obviously, once you create the target you can change the Objective-C automatic reference counting build setting to "no" for your new target.

我认为可以在源文件级别打开和关闭ARC,但我不知道如何操作.

I thought it was possible to turn ARC on and off at the source file level, but I can't figure out how.

这篇关于Objective-C:如何制定框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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