2012-11-27 71 views
0

BookmarksPlist是一個NSMutableArray,它作爲一個Dictionary存儲在Plist文件中。下面的代碼...使用addObjectsFromArray從NSMutableArray中檢索值

bookmarks = [[NSMutableArray alloc] init]; 
NSLog(@"BOOKMARKPLIST ----==== %@", BookmarksPlist); 
[bookmarks addObjectsFromArray:BookmarksPlist]; 
NSLog(@"BOOKMARK ----==== %@", bookmarks); 

...生產:

2012-11-27 11:34:33.592 BOOKMARKPLIST ----==== { 
    01Otabkey14tabkey1 = "Genesis 14"; 
    01Otabkey8tabkey1 = "Genesis 8"; 
    01Otabkey9tabkey1 = "Genesis 9"; 
} 
2012-11-27 11:34:33.592 *** -[NSMutableArray addObjectsFromArray:]: array argument is not an NSArray 
2012-11-27 11:34:33.593 BOOKMARK ----==== (
    01Otabkey8tabkey1, 
    01Otabkey9tabkey1, 
    01Otabkey14tabkey1 
) 

所以,問題是怎麼做的,我得到了書籤陣列採取BookmarksPlist陣列和值沒有鑰匙?因此,它看起來像這樣:

2012-11-27 11:34:33.593 BOOKMARK ----==== (
    "Genesis 14", 
    "Genesis 8", 
    "Genesis 9" 
) 

回答

1

BookmarksPlist可能是一本字典。您可以從allKeys的字典中獲取密鑰,並使用allValues獲取值。