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 6189085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:20:49+00:00 2026-05-24T02:20:49+00:00

I am developing a plugin for an iOS application. I am compiling it into

  • 0

I am developing a plugin for an iOS application. I am compiling it into a .a file which is then used by the main xcode project.

So far I have create a category of the UIDevice class in this library. When I run the main project using this library it crashes due to an unrecognized selector

-[UIDevice platform]: unrecognized selector sent to instance

platform is one of the fuinctions I added via the category.

So I thought it wasn’t linking those functions at all and added a c function to the same file as the UIDevice category then called it from my code .

This time the main project ran fine… So I thought maybe it was something else i did and removed the C function. But lo and behold it crashed again due to unrecognized selector..

My questions:
Why does xcode ignore the category definition unless I call a function declared in the same file?

Is there an xcode setting i can change to make it include these methods from the UIDevice category regardless of whether I call a function from that file or not?

cheers

  • 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-05-24T02:20:50+00:00Added an answer on May 24, 2026 at 2:20 am

    Check out Building Objective-C static libraries with categories:

    Objective-C does not define linker symbols for each function (or
    method, in Objective-C) – instead, linker symbols are only generated
    for each class. If you extend a pre-existing class with categories,
    the linker does not know to associate the object code of the core
    class implementation and the category implementation. This prevents
    objects created in the resulting application from responding to a
    selector that is defined in the category.

    To resolve this issue, the target linking against the static library
    must pass the -ObjC option to the linker.
    This flag causes the linker
    to load every object file in the library that defines an Objective-C
    class or category. While this option will typically result in a larger
    executable (due to additional object code loaded into the
    application), it will allow the successful creation of effective
    Objective-C static libraries that contain categories on existing
    classes.


    Important: For 64-bit and iPhone OS applications, there is a
    linker bug that prevents -ObjC from loading objects files from static
    libraries that contain only categories and no classes. The workaround
    is to use the -all_load or -force_load flags.

    Source: @albertamg (linking objective-c categories in a static library)

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

Sidebar

Related Questions

I have a plugin project I've been developing for a few years where the
I am developing a plugin.In this i take project as input from textbox which
I am developing RoR application that works with legacy database and uses ActiveScaffold plugin
When developing a plug-in to application, using the application API which doesn't run independently
I am developing an .net application which heavely depends on plugins. The application itself
I have been developing a plugin for Eclipse. The plugin has a couple of
I am developing a plugin which its command will be displayed only at certain
I am developing a plugin for an application, that application consumes my code (classLibrary),
I'm developing a plugin like application for a web site. Due to requirements it
i am developing a plugin in which i search for a particular method.Now i

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.