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

  • SEARCH
  • Home
  • 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 7883195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:28:09+00:00 2026-06-03T04:28:09+00:00

Problem This question may seem a bit long, but I try to give as

  • 0

Problem

This question may seem a bit long, but I try to give as much information as possible, since I am really staggered by this.

I am currently working an a library which should automate XML document parsing. But I am running into a problem now testing the library for the first time.

I have a library class called CSXDocumentLayout which represents the layout of a document. This class contains the private method - (NSError *)readLayoutDocument:(NSString *)fpath called from an init method.

/* MARK: Reading in Layouts */
- (NSError *)readLayoutDocument:(NSString *)fpath {
    CSXDocumentLayout *layout;
    CSXXMLParser *parser;
    BOOL state;

    layout = [CSXDocumentLayout layoutDocumentLayout];

    parser = [[CSXXMLParser alloc] initWithDocumentLayouts:
              [NSArray arrayWithObject:layout]];
    parser.file = fpath;

    state = [parser parse];

    if(state == NO || parser.error != nil) {
        return parser.error;
    }
    return nil;
}

This method will read in an XML document representing the layout of an other XML document. It is parsed by the class CSXXMLParser, which I want to test.

I create an object representing a layout document with +[CSXDocumentLayout layoutDocumentLayout]. This method is implemented in the category CSXDocumentLayout (CSXLayoutObject).

Below is my test file:

#import <Foundation/Foundation.h>
#import <CeasyXML.h>

int main(int argc, const char **argv) {
    NSAutoreleasePool *pool = [NSAutoreleasePool new];

    NSString *file;

    file = [NSString stringWithUTF8String:__FILE__];
    file = [file stringByDeletingLastPathComponent];
    file = [file stringByAppendingPathComponent:@"Layout.xml"];

    CSXDocumentLayout *layout;
    NSError *error;

    layout = [[CSXDocumentLayout alloc] initWithLayoutDocument:file 
                                                         error:&error];
    if(layout == nil) {
        NSLog(@"Could not create layout: %@", error);
        exit(0);
    }

    NSLog(@"Layout:\n%@", layout);

    [pool release];
    return 0;
}

This file compiles to a separate executable linked to my static library libceasyxml.a. Everything compiles just fine without any warnings.

But when I run it I get a unrecognized selector sent to class exception:

2012-05-02 16:59:47.620 TestApp[1887:a0f] +[CSXDocumentLayout layoutDocumentLayout]: unrecognized selector sent to class 0x1000064c8
2012-05-02 16:59:47.791 TestApp[1887:a0f] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[CSXDocumentLayout layoutDocumentLayout]: unrecognized selector sent to class 0x1000064c8'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00007fff83e47784 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x00007fff84604f03 objc_exception_throw + 45
    2   CoreFoundation                      0x00007fff83ea11a0 __CFFullMethodName + 0
    3   CoreFoundation                      0x00007fff83e198ef ___forwarding___ + 751
    4   CoreFoundation                      0x00007fff83e15a38 _CF_forwarding_prep_0 + 232
    5   TestApp                             0x0000000100001512 -[CSXDocumentLayout(Private) readLayoutDocument:] + 49
    6   TestApp                             0x00000001000010d4 -[CSXDocumentLayout initWithLayoutDocument:error:] + 96
    7   TestApp                             0x0000000100001017 main + 179
    8   TestApp                             0x0000000100000f5c start + 52
    9   ???                                 0x0000000000000001 0x0 + 1
)

I find it very disturbing that I cannot call the class method +[CSXDocumentLayout(CSXLayoutObject) layoutDocumentLayout], though I can call both -[CSXDocumentLayout initWithLayoutDocument:error:], and -[CSXDocumentLayout(Private) readLayoutDocument:].

Research

I checked if the method is defined in the output files by running nm file and it is, well partly:

In libceasyxml.a, it is defined (nm libceasyxml.a)

...
libceasyxml.a(CSXDocumentLayout+CSXLayoutObject.o):
0000000000000100 t +[CSXDocumentLayout(CSXLayoutObject) classAttributeLayout]
00000000000020e0 s +[CSXDocumentLayout(CSXLayoutObject) classAttributeLayout].eh
000000000000056b t +[CSXDocumentLayout(CSXLayoutObject) documentElementLayout]
0000000000002180 s +[CSXDocumentLayout(CSXLayoutObject) documentElementLayout].eh
0000000000000402 t +[CSXDocumentLayout(CSXLayoutObject) layoutDocumentLayout]
0000000000002148 s +[CSXDocumentLayout(CSXLayoutObject) layoutDocumentLayout].eh
0000000000000200 t +[CSXDocumentLayout(CSXLayoutObject) layoutElementLayout]
0000000000002110 s +[CSXDocumentLayout(CSXLayoutObject) layoutElementLayout].eh
0000000000000000 t +[CSXDocumentLayout(CSXLayoutObject) nameAttributeLayout]
00000000000020b0 s +[CSXDocumentLayout(CSXLayoutObject) nameAttributeLayout].eh
0000000000002098 s EH_frame1
0000000000001c49 s LC0
...

In TestApp, it is NOT defined (nm TestApp), actually I can’t find any method with the category name CSXLayoutObject.

...
0000000100001271 t -[CSXDocumentLayout setDocumentClassString:]
00000001000013a8 t -[CSXDocumentLayout setElements:]
0000000100001490 t -[CSXDocumentLayout setName:]
00000001000014db t -[CSXDocumentLayout(Private) readLayoutDocument:]
0000000100004060 t -[CSXElementList dealloc]
00000001000040b0 t -[CSXElementList elements]
...
  • 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-03T04:28:10+00:00Added an answer on June 3, 2026 at 4:28 am

    EDIT: Fixed broken link

    I suspect you have run into a known problem of categories embedded in static libraries.

    If I am right, try to compile with the linker flags -ObjC (and if that is not enough, also -all_load) and your problem should disappear.

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

Sidebar

Related Questions

At first look, my question may seem a bit vague. But I'll try to
This one may seem like a simple question, but it's really got me scratching
Ok, this may seem like a stupid question (for Flash Developers) but I really
this question may seem too basic to some, but please bear with be, it's
This post may seem overly long for just the short question at the end
This may seem like a basic/stupid/obviously-answered question, but I wanted to check: why use
This may seem like a stupid question, but I've been looking everywhere to fix
this may seem like a overly complicated question, but it has me driving me
I'm sure this question may seem foolish to some of you, but I'm here
This may seem a common question but I googled to find the right answer

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.