简体   繁体   中英

iOS Result type 'Element' does not match expected type (Swift - Coredata)

Using Xcode 7.0 and Swift 2

I am trying to execute a fetchrequest in CoreData but is not working.

Getting the below error. Not sure what the issue is. "segmentedControl" is an outlet from a segmentedControl view.

在此处输入图片说明

The strange bit is that I have used similar code in another sample project and there were no issues. Below is that code snippet

在此处输入图片说明

I have used the execute fetchrequest syntax based on this post

Use breakpoints or print statements to examine the value of firstTitle! . If it is not a string, and title in your entity is not defined as a String type, you will get this error.

Also, make sure that your segmented control is set up as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM