ich mein Projekt Swift nur 3 umgewandelt, und ich habe einen Fehler directory.path
Reihe:Wert vom Typ ‚String‘ hat kein Mitglied ‚stringByAppendingPathComponent‘
Error: Value of type 'String' has no member 'stringByAppendingPathComponent'.
ich schon let realmPath = (directory as NSString).stringByAppendingPathComponent
stattdessen versucht habe, habe ich bekam der folgende Fehler:
Cannot convert value of type 'URL' to type 'NSString' in coercion.
override func awake(withContext context: Any?) {
super.awake(withContext: context)
let directory: URL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.RazvanJulian.app")!
let realmPath = directory.path.stringByAppendingPathComponent("db.realm") /* ERROR */
RLMRealm.setDefaultRealmPath(realmPath)
realmToken = RLMRealm.default().addNotificationBlock { note, realm in
self.reloadTableData()
}
reloadTableData()
}
Bitte überprüfen sie es und lassen sie es mich wissen.
Vielen Dank im Voraus!
dies sehen https://stackoverflow.com/questions/35541747/create-directory-in-app-group-container-swift –
Sie sind forcing zu 'NSString', das 'stringByAppendingPathComponent' hat, daher wird es nicht umgewandelt – Jack