Error when activate any TyphoonAssembly - ios

I'm trying to getting started with Typhoon Framework and I have a problem.
My code is:
#interface CustomAssembly : TyphoonAssembly
the CustomAssembly don't have more code.
When I run
[CustomAssembly new] activate];
the app crash with:
-[CustomAssembly typhoonPropertiesUpToParentClass:]: unrecognized selector sent to instance 0x15e86610
How can I fix it?
What's the problem with this code?

Finally I get the answer.
The problem was that I needed to add Obj-c in "Other linker flags"
I removed this flag when I added Parse framework.

Related

iOS static library, cannot access some class methods

I'm building a static library in iOS. after importing that library in my project, I added -ObjC in Other linker flags. But when I call the class methods(currently 3 available), 2 of them are being called and executed properly, but the last one is getting this error: "+[RankConferenceLib joinConferenceWithName:]: unrecognized selector sent to class 0x5044dc".
This is my Header file of library
#interface RankConferenceLib : NSObject
+(void)initEnvironment;
+(void)orientationChange;
+(void)joinConferenceWithName:(NSString *)name;
#end
in .m file of library
+ (void)joinConferenceWithName:(NSString *)name
{
//....codes
}
and in my project I'm calling them
- (IBAction)join:(UIButton *)sender {
[RankConferenceLib joinConferenceWithName:#"User"];
}
Please tell me what I'm missing here. This is my first static library. I've searched but could not find any help which is similar as my situation here. Please mention what else you need to know.
Thank you.
I have checked this and for me it's working fine without any linker flags added.
The only one error possibility is something happened inside the + (void)joinConferenceWithName:(NSString *)name
Write a log inside the joinConferenceWithName to printout the parameter name and make sure this is calling and the problem is occurring inside that method.
+ (void)joinConferenceWithName:(NSString *)name
{
NSLog(#"the name is: %#", name);
}
Finally, make sure that you added the latest modified static library into your project.
You can download the working sample from here
Try Running using the -all_load linker flag
Apple Documentation
Stack Overflow Answer

No Visible #interface error in ios

Im getting the following issue in ios how to clear and run the code successfully.
The issue is:
"No visible #interface for 'ViewController' declares the selector 'performSelector:afterDelay:'".
There is no such function performSelector:afterDelay:.
Looking at the docs the only function that includes "performSelector" and "afterDelay" is...
performSelector:withObject:afterDelay:
and
performSelector:withObject:afterDelay:inModes:

Unrecogized selector in libBlocksKit.a

If I used actionsheet functions in UIActionSheet+BlocksKit.h category file in my project then it would be crashed(For example: +[UIActionsheet actionSheetWithTitle:] unrecognized selector). UIActionSheet+BlocksKit.h in the libBlockKit.a library. I'm using this lib
Please help me.
Add -ObjC to Other Linker Flags (OTHER_LDFLAGS) in Build settings.
See http://developer.apple.com/library/mac/#qa/qa1490/_index.html

Unit testing a static library with RestKit

I'm attempting to follow along with the RestKit unit test guide ( https://github.com/RestKit/RestKit/wiki/Unit-Testing-with-RestKit ) except that my project is a static library instead of an app.
Here is the test I've written:
- (void)testMappingOfDate
{
id parsedJSON = [RKTestFixture parsedObjectWithContentsOfFixture:#"plan.json"];
RKMappingTest *test = [RKMappingTest testForMapping:[self planMapping] object:parsedJSON];
[test expectMappingFromKeyPath:#"plan.date" toKeyPath:#"date"];
STAssertNoThrow([test verify], nil);
}
When I attempt to run the test I receive this error on the first line of the test:
error: testMappingOfDate (api_clientTests) failed: -[NSBundle parsedObjectWithContentsOfResource:withExtension:]: unrecognized selector sent to instance 0x1765c40
It seems like its not finding the NSBundle category defined by RestKit, but my test target header search path is set to "$(BUILT_PRODUCTS_DIR)/../../Headers" and I've verified this path includes NSBundle+RKAdditions.h which contains the supposed "unrecognized selector".
Is there something I'm missing here?
You are trying to include a category within your binary that comes from a library. To get that accomplished you will need to add the following to your (Unit-Test-Target's) build settings.
Other Linker Flags: -ObjC
From Apple's QA:
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.
Solution:
To resolve this issue, the static library should 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.
The error means that the "unrecognized selector" issue is at runtime. The compiler and NSBundle+RKAdditions.h do not give this error they would at compile timr.
The issue is that the code that has #implementation NSBundle(RKAdditions) is not linked into your app. So you need to add this to your build

XCode 4 : error at runtime "unrecognized selector sent to instance"

I develop a static library and build my lib.a.
When I use this library in a iOS project (iPhone app built with -ObjC and -all_load flags for linker), I get this error at runtime :
unrecognized selector sent to instance
This error occurs when I try to call a class method.
+ (MyObject *) GetSingleton;
For information, I don't get error when I call an instance method.
- (void) Log;
Have you got an idea of the problem ?
When you create your singleton, try this:
+ (MyObject *)GetSingleton {
static MyObject* singletonInstance;
#synchronized(self) {
if (!singletonInstance)
singletonInstance = [[MyObject alloc] init];
}
return singletonInstance;
}
Hope that helps.
Hum, I fixed the problem re-creating my project !
I don't know why, my project made bad linking for class method, and not for instance method.
Now, with new project and linkg to my static library, all is OK at runtime.
Maybe it was a problem because of multiples static libraries I built, with probably a bad cache or dependencies...
Thanks for your answers developers !

Resources