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

Cannot apply Mappable Protocol to NSManagedObject Subclass #61

Closed
ReaddyEddy opened this issue Feb 11, 2015 · 5 comments
Closed

Cannot apply Mappable Protocol to NSManagedObject Subclass #61

ReaddyEddy opened this issue Feb 11, 2015 · 5 comments

Comments

@ReaddyEddy
Copy link

I'm seeing a very obscure build error with objects inheriting from NSManaged object, the code below is extracted form a sample project based on the MasterDetail template. ObjectMapper is installed via 0.36.0.beta.2 Cocoapods with the _Event and Event classes generated with mogenerator 1.28 --v2 --swift. It makes no difference whether the protocol is applied to the derived Human readable class or the Machine Readable class inherited form NSManagedObject.
This builds OK:
import Foundation
import ObjectMapper
class Lump: Mappable {
var timeStamp : NSDate?
required init() {}
func mapping(map : Map) {
timeStamp <= (map["timeStamp"],DateTransform())
}
}

This does not:

import ObjectMapper
@objc(Event)
class Event: _Event, Mappable {
func mapping(map : Map) {
timeStamp <= (map["timeStamp"],DateTransform())
}
}

The error message is
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
.. snip ..
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

@tristanhimmelman
Copy link
Owner

Hi there,
Unfortunately I'm not sure what is going on here. I haven't tried using ObjectMapper with any classes that are visible to Objective-C code.

One thing I do notice in the above code is that the Event class doesn't include the initializer. Hope this helps..

@ReaddyEddy
Copy link
Author

Hi
The initialiser is provided by the base class. I suspect myself that the problem is one of using Cocoapods with the frameworks option but I'm yet to confirm that.
Thanks for the speedy response
Ed

On 12 Feb 2015, at 05:26, Tristan Himmelman notifications@github.com wrote:

Hi there,
Unfortunately I'm not sure what is going on here. I haven't tried using ObjectMapper with any classes that are visible to Objective-C code.

One thing I do notice in the above code is that the Event class doesn't include the initializer. Hope this helps..


Reply to this email directly or view it on GitHub.

@hopiaw
Copy link

hopiaw commented Feb 15, 2015

Any news with that issue?

Thanks

@ReaddyEddy
Copy link
Author

Seems as though not using CocoaPods suse_frameworks directive allows a build I’ve yet to exercise the mapper though
HTH
Ed

On 15 Feb 2015, at 23:15, Teddy Dreyfus notifications@github.com wrote:

Any news with that issue?

Thanks


Reply to this email directly or view it on GitHub #61 (comment).

@andrebraga
Copy link

I have been easily able to use ObjectMapper with Core Data. #195 for details.

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

4 participants