Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm getting this error on latest version of AERecord #29

Closed
O-mkar opened this issue Jun 9, 2016 · 2 comments
Closed

I'm getting this error on latest version of AERecord #29

O-mkar opened this issue Jun 9, 2016 · 2 comments

Comments

@O-mkar
Copy link

O-mkar commented Jun 9, 2016

I did a pod update and i started facing this error. This problem is on 3.0.0 on 2.1.0 it works fine

 private class func _firstOrCreateWithAttributes<T>(attributes: [String : AnyObject], predicateType: NSCompoundPredicateType = defaultPredicateType, context: NSManagedObjectContext = AERecord.defaultContext) -> T {
        let predicate = createPredicateForAttributes(attributes, predicateType: predicateType)
        let request = createFetchRequest(predicate: predicate)
        request.fetchLimit = 1
        let objects = AERecord.executeFetchRequest(request, context: context)

        return (objects.first ?? createWithAttributes(attributes, context: context)) as! T //Here i get the error
    }

ERROR

Could not cast value of type 'NSManagedObject_AccountDetails_' (0x7fd43ae881b0) to 'FeedbackChamp.AccountDetails' (0x1081b1220).

MY CODE

AccountDetails.firstOrCreateWithAttributes(["data" : readableJSON["result"]["hoteladded"].bool! ? 1 : 0, "detailName": "num_hotels"])

AccountDetails.firstOrCreateWithAttributes(["data" : readableJSON["result"]["num_restaurants"].int!, "detailName": "num_restaurants"])

AERecord.saveContextAndWait()

Please fix it as soon as posible

@Screon
Copy link
Contributor

Screon commented Aug 22, 2016

This answer did the trick. http://stackoverflow.com/a/29578034/2670547

@tadija
Copy link
Owner

tadija commented Sep 15, 2016

Ok, this may be closed then.

@tadija tadija closed this as completed Sep 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants