>类型’NSManagedObjectContext’不符合协议’BooleanType’.
>类型’NSManagedObjectModel’不符合协议’BooleanType’.
>类型’NSPersistentStoreCoordinator’不符合协议’BooleanType’.
还附有错误的屏幕截图.
解决方法
所以你正在处理Optionals.由于Beta 5 Optionals不再符合BooleanType协议.
您需要明确检查nil,更改:
if !_managedObjectContext { // ... }
至:
if _managedObjectContext == nil { // ... }
并为_managedObjectModel和_persistentStoreCoordinator执行相同的操作.
来自xCode 6 Beta 5发行说明:
Optionals can now be compared to nil with == and !=,even if the
underlying element is not Equatable.
和
Optionals no longer conform to the BooleanType (formerly LogicValue) protocol,so they may no longer be used in place of boolean expressions (they must be explicitly compared with v != nil). This resolves confusion around Bool? and related types,makes code more explicit about what test is expected,and is more consistent with the rest of the language. Note that ImplicitlyUnwrappedOptional still includes some BooleanType functionality. This issue will be resolved in a future beta.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。