I am developing an objective c framework to be used by other fellow developers.
In this framework I would like to use if available classes from other frameworks optionally if they are available.
For example, at the moment I am using AdSupport.framework(if is available - linked by the app developer) with the following approach:
if (NSClassFromString(@"ASIdentifierManager")) {
NSString adString = [[[NSClassFromString(@"ASIdentifierManager") sharedManager] advertisingIdentifier] UUIDString];
}
However now, I want to have arguments of public functions of my framework to include classes of optional dependencies and I am not able to do that.
For example:
I want to have a function:
+ (void) sendLocation: (CLLocation *) myLoc;
but CoreLocation.framework will be optionally linked and maybe not available to an app. How can I follow a similar approach with AdSupport.framework above?
I assumed I could do something like this:
+ (void) sendLocation: (NSClassFromString(@"CLLocation") *) myLoc;
or
+ (void) sendLocation: (id) myLoc;
or
+ (void) sendLocation: (Class) myLoc;
and then extract somehow coordinates but was not able to achieve that. Last option (Class) seems to compile but I cannot find a way to extract params..
Can anyone help with that?