我尝试使用 访问 NSManagedObject 的浮点值
float f = [managedObject.price floatValue];
并得到以下错误。我认为这个错误是当一个对象被删除并且你试图操纵它时引起的。我不更新也不删除原始对象的任何属性。是否有任何其他原因会发生此错误?
2011-07-29 13:02:54.797 AEsir[3760:707] *** Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault for '0x6095d20 <x-coredata://6483BA33-F9AD-436C-91CB-0EE6E07F2FBE/Venue/p7>''
*** Call stack at first throw:
(
0 CoreFoundation 0x35c6464f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x31cb9c5d objc_exception_throw + 24
2 CoreData 0x30a51e99 _PFFaultHandlerLookupRow + 1244
3 CoreData 0x30aa69c1 -[NSFaultHandler fulfillFault:withContext:] + 20
4 CoreData 0x30aa5789 _PF_FulfillDeferredFault + 360
5 CoreData 0x30a50f1f _sharedIMPL_pvfk_core + 58
6 CoreData 0x30ab481b _pvfk_16 + 10
7 AEsir 0x0000b641 -[VenueListViewController transactionSucceeded:] + 240
8 Foundation 0x35f31183 _nsnote_callback + 142
9 CoreFoundation 0x35c3320f __CFXNotificationPost_old + 402
10 CoreFoundation 0x35bcdeeb _CFXNotificationPostNotification + 118
11 Foundation 0x35f2e5d3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 70
12 AEsir 0x00036c67 -[CreditManager finishTransaction:wasSuccessful:] + 170
13 AEsir 0x00036d4b -[CreditManager completeTransaction:] + 106
14 AEsir 0x00036ffb -[CreditManager paymentQueue:updatedTransactions:] + 246
15 StoreKit 0x35970da9 __NotifyObserverAboutChanges + 44
16 CoreFoundation 0x35bcc3c5 CFArrayApplyFunction + 40
17 StoreKit 0x359727f1 -[SKPaymentQueue _notifyObserversAboutChanges:] + 92
18 StoreKit 0x35972351 -[SKPaymentQueue _processUpdates:trimUnmatched:] + 860
19 StoreKit 0x35971137 -[SKPaymentQueue _transactionUpdatedNotification:] + 98
20 Foundation 0x35f31183 _nsnote_callback + 142
21 CoreFoundation 0x35c3320f __CFXNotificationPost_old + 402
22 CoreFoundation 0x35bcdeeb _CFXNotificationPostNotification + 118
23 Foundation 0x35f2e5d3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 70
24 AppSupport 0x35272455 -[CPDistributedNotificationCenter deliverNotification:userInfo:] + 44
25 AppSupport 0x35273781 _CPDNDeliverNotification + 204
26 AppSupport 0x352721d7 _XDeliverNotification + 122
27 AppSupport 0x35268dd7 migHelperRecievePortCallout + 138
28 CoreFoundation 0x35c3ba97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
29 CoreFoundation 0x35c3d83f __CFRunLoopDoSource1 + 166
30 CoreFoundation 0x35c3e60d __CFRunLoopRun + 520
31 CoreFoundation 0x35bceec3 CFRunLoopRunSpecific + 230
32 CoreFoundation 0x35bcedcb CFRunLoopRunInMode + 58
33 GraphicsServices 0x30b5d41f GSEventRunModal + 114
34 GraphicsServices 0x30b5d4cb GSEventRun + 62
35 UIKit 0x30dd9d69 -[UIApplication _run] + 404
36 UIKit 0x30dd7807 UIApplicationMain + 670
37 AEsir 0x00008093 main + 70
38 AEsir 0x00002d8c start + 52
)
最佳答案
如果持久存储发生某些事情,例如您从上下文使用的持久存储管理器中删除存储。
但是,很可能托管对象已被删除,但您在别处保留了对它的引用。
关于ios - CoreData 无法完成未修改对象发生的错误。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6876605/
总的来说,我对ruby还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用
我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-
在控制台中反复尝试之后,我想到了这种方法,可以按发生日期对类似activerecord的(Mongoid)对象进行分组。我不确定这是完成此任务的最佳方法,但它确实有效。有没有人有更好的建议,或者这是一个很好的方法?#eventsisanarrayofactiverecord-likeobjectsthatincludeatimeattributeevents.map{|event|#converteventsarrayintoanarrayofhasheswiththedayofthemonthandtheevent{:number=>event.time.day,:event=>ev
大约一年前,我决定确保每个包含非唯一文本的Flash通知都将从模块中的方法中获取文本。我这样做的最初原因是为了避免一遍又一遍地输入相同的字符串。如果我想更改措辞,我可以在一个地方轻松完成,而且一遍又一遍地重复同一件事而出现拼写错误的可能性也会降低。我最终得到的是这样的:moduleMessagesdefformat_error_messages(errors)errors.map{|attribute,message|"Error:#{attribute.to_s.titleize}#{message}."}enddeferror_message_could_not_find(obje
我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
我有一个表单,其中有很多字段取自数组(而不是模型或对象)。我如何验证这些字段的存在?solve_problem_pathdo|f|%>... 最佳答案 创建一个简单的类来包装请求参数并使用ActiveModel::Validations。#definedsomewhere,atthesimplest:require'ostruct'classSolvetrue#youcouldevencheckthesolutionwithavalidatorvalidatedoerrors.add(:base,"WRONG!!!")unlesss
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
好的,所以我的目标是轻松地将一些数据保存到磁盘以备后用。您如何简单地写入然后读取一个对象?所以如果我有一个简单的类classCattr_accessor:a,:bdefinitialize(a,b)@a,@b=a,bendend所以如果我从中非常快地制作一个objobj=C.new("foo","bar")#justgaveitsomerandomvalues然后我可以把它变成一个kindaidstring=obj.to_s#whichreturns""我终于可以将此字符串打印到文件或其他内容中。我的问题是,我该如何再次将这个id变回一个对象?我知道我可以自己挑选信息并制作一个接受该信
我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳