2012-02-20 27 views
0

我已经在ios4中实现了ALAssetsLibraryChangedNotification,它工作得很完美,但是现在在ios5中它似乎被忽略了。我补充一下:ALAssetsLibraryChangedNotification没有在ios5中被触发?

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ALAssetsLibraryChangedNotification) name: ALAssetsLibraryChangedNotification object:self.library]; 
在我的视图控制器初始化

,并在dealloc中我把:

[[NSNotificationCenter defaultCenter] removeObserver:self name:ALAssetsLibraryChangedNotification object:nil]; 

然后methdod实现本身是:

- (void) ALAssetsLibraryChangedNotification 
{ 
//doSomeStuff 

} 

我需要将其添加在初始化并在dealloc中将其删除,以便在用户更改应用程序之外的库时更新它。任何人都知道这个很好的解决方案?

+0

这是一个[iOS5中的bug(http://www.openradar.me/10484334)。因此,我们必须在我写的链接中描述解决方法。 – KatokichiSoft 2012-02-26 08:59:03

回答

4

我认为他的意思是说:

  1. 电话[self.assetsLibrary writeImageToSavedPhotosAlbum:无元数据:无completionBlock:^(NSURL * assetURL,NSError *错误){}]。 ALAssetsLibrary
  2. 的创建实例后立即
  3. 观察ALAssetsLibraryChangedNotification(不NSManagedObjectContextObjectsDidChangeNotification)
+0

工作表示感谢。 – 2012-03-10 08:43:32