- Home /
Unable to access the function of Category class inside the iOS library in Unity
I have a made an iOS library which contains the functionality of sharing using twitter. Every function is working fine. I can call native functions defined inside the library & in return I can call the functions of C# script of Unity. I am able to log in the twitter using some account. When Twitter login is successful, I am trying to post some text using that particular twitter account. In the process of posting there's one function defined inside a category class. When it is called, the application crashes saying unrecognised selector being called. The error is as followed.
+[NSString stringWithNewUUID] Unrecognised selector sent to instance.
I will elaborate this further. The iOS Library that I have made is "TwitterShare". In this Twitter share there is a category class NSString+UUID.h & NSString+UUID.m. There is function inside this class which is
#import "MGTwitterEngineGlobalHeader.h" @interface NSString (UUID) + (NSString*)stringWithNewUUID; @end #import "NSString+UUID.h" @implementation NSString (UUID) + (NSString*)stringWithNewUUID { // Create a new UUID NSLog(@"NewUUID Called"); CFUUIDRef uuidObj = CFUUIDCreate(nil); // Get the string representation of the UUID NSString *newUUID = (NSString*)CFUUIDCreateString(nil, uuidObj); CFRelease(uuidObj); return [newUUID autorelease]; } @end
I have copied the required classes to be used as library inside Unity. From one of the scripts inside Unity I am calling a function defined inside the library that which shows a user interface where a user can login into his twitter account. After successful login the text sent while calling the login function in library is posted using
[[TwitterHelper sharedInstance] postStatus:self._mTwitterMessage];
In the process of calling the posting function the application crashes with message +[NSString stringWithNewUUID] Unrecognised selector sent to instance.. Actually from Unity the function inside the category class present in the native iOS library, not getting called.
I will really appreciate anyones help to solve this problem as I am on the verge of building a successful iOS library for the first time.