realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.29k stars 2.14k forks source link

why? #5257

Closed qq565999484 closed 7 years ago

qq565999484 commented 7 years ago

2017-08-23 18:17:48.548 RealmSwiftDemo[20671:3180440] NSForwarding: warning: object 0x103cd97b0 of class 'RealmSwiftDemo.Dog' does not implement methodSignatureForSelector: -- did you forget to declare the superclass of 'RealmSwiftDemo.Dog'? 2017-08-23 18:17:48.549 RealmSwiftDemo[20671:3180440] NSForwarding: warning: object 0x103cd97b0 of class 'RealmSwiftDemo.Dog' does not implement doesNotRecognizeSelector: -- abort

kishikawakatsumi commented 7 years ago

Please provide the information that was requested in the new issue template and described in our documentation on filing issues.

Also, please provide your code including at least the definition of the model. We have never seen such a log. I think that there is probably something wrong with the definition of the model.

@qq565999484

qq565999484 commented 7 years ago

------this is alll code:


import UIKit
import RealmSwift

class Dog: Object
{

    @objc dynamic var name = ""
    @objc dynamic var age = 0

    override var description: String { return "dog {\(name), \(age)}" }
}
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.

        let myDog = Dog(value: ["name":"1xasxa22","age" : 2])
        let myDog2 = Dog()
        myDog2.name = "DeLorean"
        myDog2.age = 111

        let realm = try! Realm(configuration: Realm.Configuration(inMemoryIdentifier: "TemporaryRealm"))

        try! realm.write {
            realm.add(myDog)
            realm.add(myDog2)
        }
        return true
    }

@kishikawakatsumi

qq565999484 commented 7 years ago

------this is alll code: ---》Of course, I've tried it:


import UIKit
import RealmSwift

class Dog: Object
{

     dynamic var name = ""
     dynamic var age = 0

    override var description: String { return "dog {\(name), \(age)}" }
}
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.

        let myDog = Dog(value: ["name":"1xasxa22","age" : 2])
        let myDog2 = Dog()
        myDog2.name = "DeLorean"
        myDog2.age = 111

        let realm = try! Realm(configuration: Realm.Configuration(inMemoryIdentifier: "TemporaryRealm"))

        try! realm.write {
            realm.add(myDog)
            realm.add(myDog2)
        }
        return true
    }
qq565999484 commented 7 years ago

My Realm.FrameWork was towed directly to the project

bdash commented 7 years ago

@qq565999484, did you see the list of information requested in the new issue template and in our documentation on filing issues? It appears that the majority of the information requested in those two places has not yet been provided.

qq565999484 commented 7 years ago

Sorry, I may not understand what you mean because of my low level

austinzheng commented 7 years ago

Can you send us your project? You can make it into a zip file and attach it to this GitHub ticket. Then we can run it and see what is happening.

qq565999484 commented 7 years ago

RealmSwiftDemo.zip I'm sorry, because I will upload limit, to cancel the inside of the Realm.framework and RealmSwift.framework. You need to add.Framework.

bdash commented 7 years ago

Which version of Realm are you using? That's one of the pieces of information that we requested earlier.

qq565999484 commented 7 years ago

realm-swift-2.10.0.zip=>swift-3.1 xcode: xcode8.3.3 OS:10.12.6

austinzheng commented 7 years ago

I opened your project in Xcode and note that you only have the RealmSwift framework defined in your project navigator. Our instructions say you need both the RealmSwift.framework and Realm.framework. It's possible you copied the Realm.framework but didn't add it to your project definition. Can you add Realm.framework to your application and try again please?

austinzheng commented 7 years ago

Once I added both frameworks, the project built and ran without errors on my computer.

qq565999484 commented 7 years ago

thanks。

qq565999484 commented 7 years ago

# Thank you very much for your help error