为核心数据迁移生成映射模型后,关系映射的所有值表达式都正确生成,除了 1 个值表达式,其中参数使用单引号 (') 而不是双引号 (")。这导致解析错误。
这是我所期望的:
FUNCTION($manager ,"destinationInstancesForEntityMappingNamed:sourceInstances:" , "MatchToMatch" , $source.matches)
但是函数表达式是这样生成的:
FUNCTION($manager ,'destinationInstancesForEntityMappingNamed:sourceInstances:' , 'MatchToMatch' , $source.matches)
A specific Value Expression is always generated with single quotes
当我将右侧栏中的“Source Fetch”选项更改为“Use Custom(...)”并手动输入表达式时,所有双引号都会变回单引号。
当我直接在映射编辑器表中更改值表达式时,我收到以下错误消息:
Unable to parse the format string "FUNCTION($manager >,"destinationInstancesForEntityMappingNamed:sourceInstances:" , >"MatchToMatch" , $source.matches) == 1"
当我构建并运行迁移时,我收到以下错误消息:
2016-01-27 10:30:33.875 mapc[1431:352140] *** Terminating app due to >uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse >the format string "FUNCTION($manager >,'destinationInstancesForEntityMappingNamed:sourceInstances:' , >'MatchToMatch' , $source.matches) == 1"'
谁能解释一下发生了什么以及我该如何解决这个问题?
最佳答案
这里的问题是 matches 是一个保留关键字。
关于ios - 核心数据关系映射 : Double Quotes in Value Expression are automatically turned into single quotes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35034916/