2011-09-29 7 views
0

plist에서 데이터를로드하는 기능을 가진 두 번째보기가있는 tableView을 만들었습니다. 그것은 작동하지만 plist에 데이터를 변경할 때 응용 프로그램이 자동으로 새로 고쳐 지도록 서버에 plist를 넣으려고합니다.iphone 앱 - 서버의 plist (자동 새로 고침)

코드 : DICTIONARY이 테이블의 데이터 소스가 될 것입니다

// Get a plist and copy in its contents into an array 
- (id)initWithLibraryName:(NSString *)libraryName { 
    if ((self = [super init])) { 
     libraryPlist = libraryName; 
     libraryContent = [[NSArray alloc] initWithContentsOfFile: 
          [[NSBundle mainBundle] pathForResource:libraryPlist 
                  ofType:@"plist"]]; 
    } 
    return self; 
} 

// [Safely] returns a "DVD" from the plist. Each item in the data source is a 
// dictionary containing data about the chosen DVD. 
- (NSDictionary *)libraryItemAtIndex:(int)index { 
    return (libraryContent != nil && 
      [libraryContent count] > 0 && 
      index < [libraryContent count]) 
       ? [libraryContent objectAtIndex:index] : nil; 
} 

답변

0
NSURL *url = [NSURL URLWithString:@"http://mydomain.com/file.plist"]; 
NSDictionary *DICTIONARY = [[NSDictionary alloc] initWithContentsOfURL:url];