Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
761 views
in Technique[技术] by (71.8m points)

ios - Objective-C: How to make a Framework?

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

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!).

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?

EDIT: 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)

Does anybody know why?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For your purpose, a regular static library as described by beryllium would do fine.

Just for unashamed plug purposes and for spreading the word, this document describes how to create versioned, documented frameworks using Xcode, GIT and DoxyGen.

Creating a Versioned Framework 1.23

The main purpose of creating such frameworks is to redistribute them. I personally find it extremely annoying to manually include libraries and headers I receive from third parties - especially if the libraries are delivered in separate versions for simulator and device. That guide is meant for classic middleware developers. I have written it to allow people like those folks from Google Analytics to finally provide something worth their brand.

This document gives you a step by step explanation, bundled with loads of screenshots.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...