Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8686621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:54:02+00:00 2026-06-12T22:54:02+00:00

Possible Duplicate: What is the best way to solve an Objective-C namespace collision? I

  • 0

Possible Duplicate:
What is the best way to solve an Objective-C namespace collision?

I have develop a third-party dynamic library for iphone, depends on Mobile Substrate.
The problem is that if some APP have a Obj-C class named “Class1”, while my dylib also have a class named “Class1”, there is no guarantee that which class will be used at run time.
Is there any solution that I can keep the class name “Class1” and solve the namespace problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:54:04+00:00Added an answer on June 12, 2026 at 10:54 pm

    In Objective-C the concept of namespace doesn’t exist, source files are simply imported one in another and this of course can cause name collisions if common name are used as class name.

    A good way to solve collision problems in Objective-C is adopt a prefix to differentiate your class name from other class names, and this is the technique already used by Apple itself, lets think about the array class, it is called NSArray, why ?

    There is a specific reason behind that :

    • N : identify Next
    • S : identify Step
    • Array : identify the name of the data structure

    NextStep is the name of the company that created the Foundation framework, and the company that was acquired by Apple in the mid 90’s.

    I’m for example using a different prefix for my classes that I pack in libraries, I use : AleArray first 3 characters of my name followed by the name of the data structure, you can choose your own prefix and go ahead with that …

    Of course, the probability of a collision using a simple prefix still higher than using namespaces(that usually use a reverse domain name notation), but could be enough in most situations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Best way to stop SQL Injection in PHP I have seen some
Possible Duplicate: Best way to programmatically detect iPad/iPhone hardware For example I want my
Possible Duplicate: ASP.Net:Best way to run scheduled tasks I have to make a scheduled
Possible Duplicate: Best way to detect integer overflow in C/C++ If I have an
Possible Duplicate: What's the best way to develop a sideswipe menu like the one
Possible Duplicate: Best way to provide charts on the web? Server-side or client-side library?
Possible Duplicate: Best Way to Sprite Images? I have the following image that I
Possible Duplicate: Best way to define private methods for a class in Objective-C Hi,
Possible Duplicate: Best way to strip punctuation from a string in Python I have
Possible Duplicate: Best way to get identity of inserted row? I have an INSERT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.