2013-10-01 3 views
0

캘린더 이벤트에서 Name, LocationNotes을 나열하려고합니다. NameNotes을 읽고 쓰는 것은 예상대로 작동하지만 위치 필드에 문제가 있습니다.EventKit - 'location'이라는 여러 메서드

는 특히, 다음 줄은 "meetingLocation = [element location];는"여기 뭐가 문제 오류

"Multiple methods named 'location' found with mismatched result, parameter type or attributes." 

을 생산? 코드는 아래에 포함되어 있습니다.

- (IBAction를) reloadEvents (ID) 보낸 사람 {

NSString *meetingName; 
NSString *meetingLocation; 
NSString *meetingNotes; 

// Define a range of event dates we want to display 
NSDate *startDate = [NSDate dateWithTimeIntervalSinceNow:(-1*60*60*.5)]; // .5 hour in the past 
NSDate *endDate = [NSDate dateWithTimeIntervalSinceNow:(60*60*24*1)]; // 1 day from now 
//NSDate *endDate = [NSDate dateWithTimeIntervalSinceNow:(60*60*24*7)]; // 7 days from now 

// Create a predicate to search all celndars with our date range using the start date/time of the event 
NSPredicate *predicate = [self.eventStore predicateForEventsWithStartDate:startDate endDate:endDate calendars:nil]; 

// Query the event store using the predicate. 
NSArray *results  = [self.eventStore eventsMatchingPredicate:predicate]; 

// Convert the results to a mutable array and store so we can implement swipe to delete 
//NSMutableArray *events = [[NSMutableArray alloc] initWithArray:results]; 
//self.events   = events; 

NSEnumerator * enumerator = [results objectEnumerator]; 
id element; 

while(element = [enumerator nextObject]) 
{ 

    // Set the meeting name 
    meetingName = [element title]; 
    NSLog(@"Name=%@",meetingName); 

    // Set the meeting location 
    meetingLocation = [element location]; 
    NSLog(@"Location=%@",meetingLocation); 

    // Set the meeting notes 
    meetingNotes = [element notes]; 
    NSLog(@"Notes=%@",meetingNotes); 

} 

}

답변

0

iOS7에 일부 구에서 iOS 5 변환이

while(element = [enumerator nextObject]) 
{ 
    EKEvent *event = element; 
    meetingName = event.location; 
} 
+0

감사하고! 그것은 그 문제를 해결했습니다. – user2833301

0

비슷한 문제 같은 시도 :

if ([[thisEvent.recurrenceRules objectAtIndex:i] frequency] == EKRecurrenceFrequencyDaily ){ 

"frequency"라는 여러 메서드 이름이 일치하지 않아 발견되었습니다.

는 타입 캐스팅에 의해 해결 된 다음 if 문

EKRecurrenceRule *thisRecurranceRule = (EKRecurrenceRule *)[thisEvent.recurrenceRules objectAtIndex:i] ; 
if ([thisRecurranceRule frequency] == EKRecurrenceFrequencyDaily ){