2014-01-06 58 views
0

如何更改日曆的名稱?我有:在iOS中重命名EKCalendar

EKCalendar *cal; 

cal=[store calendarWithIdentifier:@"5F9A5BE0-03A9-4FE8-BD1E-2647F39E268F"];  

cal.title = @"Calendar custom 2"; 
cal.source = localSource; 
NSError *error = nil; 
BOOL saved = [store saveCalendar:cal commit:YES error:&error]; 
NSLog(@"%d -> %@",saved,error); 

但這並不保存,本刊:

0 -> Error Domain=EKErrorDomain Code=15 "That calendar may not be moved to another account." UserInfo=0xb05c8a0 {NSLocalizedDescription=That calendar may not be moved to another account.} 

有人可以幫助我!

+0

你爲什麼改變一個源代碼? –

回答

2

根據文檔source不能更改,請嘗試僅更改title屬性。

0

我也面臨同樣的問題。問題是,你不應該設置現有日曆的來源。 EKSource只應在創建新日曆時進行設置。