Note that there are some explanatory texts on larger screens.

plurals
  1. POClass extensions and frameworks
    text
    copied!<p>I have develop my own framework that contains useful classes/methods that I often use in my apps. Recently, I've added a class extension for NSString "NSString+Extensions.h/m" to add my own methods. Example : </p> <ul> <li>NSString+Extensions.h</li> </ul> <blockquote> <pre><code>@interface NSString (Extensions) - (NSString *)removeDiacritics; @end </code></pre> </blockquote> <ul> <li>NSString+Extensions.m</li> </ul> <blockquote> <pre><code>#import "NSString+Extensions.h" @implementation NSString (Extensions) - (NSString *)removeDiacritics { return [[[NSString alloc] initWithData:[self dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES] encoding:NSASCIIStringEncoding] autorelease]; } @end </code></pre> </blockquote> <p>I successfully compile my framework. But when I try to use one of the functions of this class extension in any application : </p> <ul> <li>AppDelegate.m</li> </ul> <blockquote> <pre><code>// CUtils is the name of the framework. CUtils.h contains #import of all header files // contained in my framework #import &lt;CUtils/CUtils.h&gt; @implementation AppDelegate ... - (void)applicationDidBecomeActive:(UIApplication *)application { /* Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previouslyin the background, optionally refresh the user interface. */ NSString *toto = @"Je suis une chaîne avec des caractères spéciaux"; NSLog(@"%@", toto); NSLog(@"%@", [toto removeDiacritics]); } </code></pre> <p>...</p> </blockquote> <p>I get the following error : </p> <p>2012-01-31 17:01:09.921 TestCUtils[4782:207] Je suis une chaîne avec des caractères spéciaux 2012-01-31 17:01:09.924 TestCUtils[4782:207] <strong>-[__NSCFConstantString removeDiacritics]: unrecognized selector sent to instance 0x340c</strong></p> <p>But if I add my class extension directly in the application (outside of my framework), it works fine...</p> <p>Any hint?</p> <p>** EDIT **</p> <p>As some of you have asked, I've added -all_load and -ObjC options in 'Other Linker Flags', but the issue remains.</p> <p><img src="https://i.stack.imgur.com/eYU46.png" alt="enter image description here"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload