How to solve symbol conflict in Objective-C

In Objective-C, you usually prefix your class with your initial.
For example, I would declare my Box class like JABox.
Because it becomes 2nd nature to Mac programmers, we usually don’t have symbol conflict problem.

However, if you are really really unlucky, you can use two separated 3rd party libraries or framework with same class name, structure, and so on. Unlike C++, Objective-C doesn’t provide namespace.
( Personally I don’t see usefulness of namespace in Objective-C. Philosophy is different between C++ and Objective-C. C++ is like “all the tools you need to have”, while Objective-C is “not to introduce more complexity than necessary. Make things simple. If it is not essential, don’t add any facility to Objective-C.” )

However, if you really really really need to solve symbol conflict, what should you do?

Today I found some explanation on the subject.

The point is to use @compatibility_alias. Loading each framework dynamically and unloading can’t be applied to any library and very un-handy.


One response to this post.

  1. […] JongAm has the skinny. […]


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: