0

I want to check whether EventKit Framework is included or not in the project. I have used the below method to check : NSClassFromString(@"EKEventStore") It worked. Even though i haven't included the EventKit framework in the project but I am getting success response. Finally, i found because of MessageUI framework causes this success.

Is there any relationship between EventKit and MessageUI Framework ? Or Could anyone suggest me to how to find EventKit framework is included in the project by programmatically.

Bharath
  • 198
  • 1
  • 1
  • 9

1 Answers1

0

If you need to test whether the framework is included in your project at compile-time, just #include <EventKit/EventKit.h>; you'll get an error if you haven't included the framework.

If you need to test whether the framework is available to your app at runtime, use NSClassFromString like you are. If the framework is not available on the device, then it will return nil.

It doesn't really make sense to do checks at runtime for the contents of the project that was used to build the app.

Simon
  • 25,468
  • 44
  • 152
  • 266
  • In my case, i need to check at runtime only(I am using SDK). NSClassFromString(@"EKEventStore") returns something when MessageUI framework is included.That is why I asked? – Bharath Nov 12 '13 at 13:01
  • You've asked "Could anyone suggest me to how to find EventKit framework is included in the project by programmatically" - but that doesn't make sense at runtime. – Simon Nov 12 '13 at 14:25
  • From sdk, I have used to do a simple check for whether that framework is added or not. I simply want to know any other possible condition available? – Bharath Nov 13 '13 at 08:32
  • What do you mean "whether that framework is added or not"? At runtime, a framework is available to your app, or it is not, and NSClassFromString will tell you which. Your project is used for building the app, not for running it. – Simon Nov 13 '13 at 09:25
  • In SDK, I've changed EventKit as optional by programmatically.Consider someone using my SDK in some other project. While using my SDK related call, that time I need to check EventKit is included in that project or not. Then only i can invoke EventKit method and its functionalities. So, I want to know how to check programmatically? – Bharath Dec 04 '13 at 10:32
  • 1
    I think you may be missing the point. They include your SDK in their project, and then build their app. Once their app is built, it has nothing further to do with the project. Runtime doesn't happen until the app is run; you can't ask questions about the project at that point. You can check whether EventKit is available to the app, but that doesn't depend on whether they included it in their project or not. – Simon Dec 04 '13 at 10:45
  • Yes. Not in project its from app. – Bharath Dec 04 '13 at 10:56