核心数据验证崩溃

时间:2014-03-07 08:49:16

标签: ios iphone objective-c core-data rubymotion

我在核心数据上下文保存期间遇到崩溃(分段错误),如果我的模型中有此代码:

class Tag < CDQManagedObject
  def validateName(valuePointer, error: errorPtr)
    puts valuePointer[0]
    true
  end
end

如果我删除puts并仅使用valuePointer[0],它仍然会崩溃。如果我使用NSLog(@"%@", valuePointer)它仍然会崩溃。以任何方式触摸valuePointer似乎都会崩溃。

实际设备上的应用程序错误转储如下所示:

Incident Identifier: BDBB7F3A-A2D5-4D86-ADB8-E0B3CFADF19F
CrashReporter Key: 3d8fbffc3fadcdfadec2b74f199092e2f4a5224b
Hardware Model: iPhone6,1
Process: CraftyCrap [2057]
Path: /var/mobile/Applications/BC0BB2E7-9183-4DC6-9297-76A246C78B28/CraftyCrap.app/CraftyCrap
Identifier: com.waywardgypsy.craftycrap
Version: 0.0.5 (5)
Code Type: ARM (Native)
Parent Process: launchd [1]

Date/Time: 2014-03-07 01:55:21.322 -0600
OS Version: iOS 7.0.6 (11B651)
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000008
Triggered by Thread: 0

Thread 0 Crashed:
0 libobjc.A.dylib  0x389ef77b lookUpImpOrForward + 47
1 libobjc.A.dylib  0x389e7869 class_getInstanceMethod + 37
2 CraftyCrap  0x00a3ac29 rb_vm_dispatch + 697
3 CraftyCrap  0x008a2201 vm_fast_aref + 809
4 CraftyCrap  0x008a5111 rb_scope__validateName:error:__ (tag.rb:3)
5 CraftyCrap  0x008a5205 __unnamed_7 + 165
6 CoreData  0x2e4104fb -[NSManagedObject(_NSInternalMethods) _validateValue:forProperty:andKey:withIndex:error:] + 167
7 CoreData  0x2e4103b1 -[NSManagedObject(_NSInternalMethods) _validatePropertiesWithError:] + 269
8 CoreData  0x2e41028f -[NSManagedObject(_NSInternalMethods) _validateForSave:] + 99
9 CoreData  0x2e411bf9 -[NSManagedObject validateForUpdate:] + 65
10 CoreData  0x2e40f7e7 -[NSManagedObjectContext(_NSInternalAdditions) _validateObjects:forOperation:error:exhaustive:forSave:] + 2003
11 CoreData  0x2e40efcf -[NSManagedObjectContext(_NSInternalAdditions) _validateChangesForSave:] + 371
12 CoreData  0x2e40ec39 -[NSManagedObjectContext(_NSInternalChangeProcessing) _prepareForPushChanges:] + 261
13 CoreData  0x2e402bd3 -[NSManagedObjectContext save:] + 347

1 个答案:

答案 0 :(得分:0)

很抱歉回答我自己的问题。

这是RubyMotion中的一个缺陷,已在2.25中修复:

  • 修正了Ruby中定义的KVC属性验证方法不会出现的错误 用适当的(指针)类型编译。