EventKit in Universal app (OS3.2) - weak link
hi guys!
I have a universal app that uses EventKit. I started coding the iPhone 4.0 part, with the new SDK and it worked perfectly. They i started coding for iPad and didnt add the EventKit code and it worked perfectly. {as well it should since its an appstore approved app that has been selling for about a yr now}.
I realize EventKit is not available for the iPad OS 3.2 yet and will be in November. But i wanted to get the app out before Nov. So i pushed thru and got the code into the universal app, the code is very simple, it just creates an event and adds it to the calendar with an alarm. Its the same code as in the iPhone part. The minute i added the #import <EventKit/Eventkit.h> line, i got a dyld library not found, image not found, data formatters temp unavailable, loader is presently locked error and the app crashes on startup.
What ive done:
1) Selected weak link in the target settings for that framework - that just gives me a white screen on the ipad simulator, it doesnt crash, but it doesnt get past the white screen.
2) I am already using NSClassFromString on the one line where the EKEventStore class gets called.
Here is the eventkit related code:
self.eventStore = [[NSClassFromString(@"EKEventStore") alloc] init];
// Get the default calendar from store.
self.defaultCalendar = [self.eventStore defaultCalendarForNewEvents];
for (int i=0; receivedArray.count > i; i++) {
NSLog(@"%i",i);
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.title = [receivedArray objectAtIndex:i];
NSMutableArray *myAlarmsArray = [[NSMutableArray alloc] initWithObjects:[EKAlarm alarmWithRelativeOffset:-3600],nil];
event.alarms = myAlarmsArray;
event.startDate = [[NSDate alloc] init];
event.endDate = [[NSDate alloc] initWithTimeInterval:600 sinceDate:event.startDate];
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore saveEvent:event span:EKSpanThisEvent error:&err];
[myAlarmsArray release];
}
and here is the actual console error:
dyld: Library not loaded: /System/Library/Frameworks/EventKit.framework/EventKit
Referenced from: /Users/Pitamac/Library/Application Support/iPhone Simulator/3.2/Applications/08624661-2FA9-40C4-AC28-2E77866EC16F/LoveMe.app/LoveMe v3.0 calendar
Reason: image not found
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Cannot call into the loader at present, it is locked.)
Could it be the 3.2 simulator is not finding the eventkit libraries?
Last edited by marciokoko; 09-06-2010 at 03:23 PM.
Reason: possible solution
|