错误: - [UIImage _deleteExternalReferenceFromPermanentLocation]无法识别的选择器发送到实例 [英] Error: -[UIImage _deleteExternalReferenceFromPermanentLocation] unrecognized selector sent to instance

查看:114
本文介绍了错误: - [UIImage _deleteExternalReferenceFromPermanentLocation]无法识别的选择器发送到实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我删除包含图像的托管对象时,在外部记录中存储为可变换值,那么我会崩溃并显示此错误:

When I delete a managed object that contains image, stored as transformable value in external record, then I got crash and this error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage _deleteExternalReferenceFromPermanentLocation]: unrecognized selector sent to instance 0xde49360' 


推荐答案

我回答了类似于 Apple开发人员论坛

我猜您在数据建模器的该字段上选中了外部存储复选框。

I answered to something similar in the Apple Developer forums.
I am guessing you have the external storage checkbox selected on that field in the data modeller.

有一个错误可以解决。我这样做:

一旦你更新了数据并保存了上下文,任何删除它的尝试都会引发这个无法识别的选择器异常。

强制正确对象可以响应_deleteExternalReferenceFromPermanentLocation消息,请执行以下操作:

There is a bug in that can be worked around. I did it like this:
Once you have updated your data, and saved the context, any attempt to delete it will raise this 'unrecognized selector' exception.
To force the correct object that can respond to the _deleteExternalReferenceFromPermanentLocation message, do this:

[[self managedObjectContext] refreshObject:myobject mergeChanges:NO];

对象变成故障。当您下次访问它或删除它时,外部数据将被如期删除,因为包装外部数据的正确对象将从存储中提取,并会正确响应_deleteExternalReferenceFromPermanentLocation。

The object turns into a fault. When you next access it, or delete it, the external data is deleted as expected as the correct object that wraps your external data will be pulled from the store and will correctly respond to _deleteExternalReferenceFromPermanentLocation.

这篇关于错误: - [UIImage _deleteExternalReferenceFromPermanentLocation]无法识别的选择器发送到实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆