views:

32

answers:

4

I made iPhone app with eventkit framework. However, i upgrade to universal app, app can't run in ipad. I got error message

dyld: Library not loaded: /System/Library/Frameworks/EventKit.framework/EventKit

Yes, event kit only work for iOS 4.0 or later. So, how to make it for universal.

I want to make , if iPad app, don't use event kit framework.

However, I can't add

#import <EventKit/EventKit.h>
#import <EventKitUI/EventKitUI.h>

in run time

A: 

Do the answers to this question help?

http://stackoverflow.com/questions/3983518/universal-ios-app-crashing-on-iphone-itouch-3-1-3-due-to-uipopovercontroller

Nimrod
sorry ... can't help ... my problem is eventkit framework is using Delegate. So, iPad can't run EKEventEditViewDelegate
saturngod
A: 

Need to make weak linking.

Right Click on Target -> Get Info -> General Tab

change Eventkit Framework required to weak.

saturngod
A: 

I know this is a really weak answer, but the only answer if you need EventKit on the iPad: Wait until next month when iOS 4.2 ships for the iPad. At this time use the 4.2 beta to develop your universal app. Maybe your app can be ready when the App Store starts accepting apps requiring iOS 4.2.

Mr. Berna
+1  A: 

You need to do two things:

  1. First, weak link against the EventKit framework. You do this in Target->Get Info->General.

  2. Secondly, you need to decide at run time whether or not certain functionality is available:

    Class someClass = NSClassFromString(@"SomeClass");
    if(someClass) {
      // iOS4 code
    }
    else {
      // iOS3.2 code
    }
    
Stephen Darlington