Domanda

I am getting a crash (segmentation fault) during core data context save, if I have this code in my model:

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

If I remove the puts and just use valuePointer[0] it still crashes. If I use NSLog(@"%@", valuePointer) it still crashes. Touching valuePointer in any way seems to crash.

The application error dump on an actual device looks like this:

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
È stato utile?

Soluzione

Sorry to answer my own question.

This is a defect in RubyMotion, and has been fixed in 2.25:

  • Fixed a bug where KVC property validation methods defined in Ruby would not be compiled with the appropriate (Pointer) types.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top