保存先のファイルパスを指定してRealmを取得する方法がわかりません
let realm = try! Realm()
のところで、
test1
2015-08-17 07:15:03.482 test-key[93017:5643534] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
test1.5
test2
test3
と出てしまいます。
ソースは下記の通りです。
import UIKit
import RealmSwift
import Foundation
class dic: Object {
dynamic var ID = 0
dynamic var yomi = ""
dynamic var emoji = ""
dynamic var date = NSDate(timeIntervalSince1970: 1)
override static func primaryKey() -> String? {
return "ID"
}
}
class KeyboardViewController: UIInputViewController {
@IBOutlet var nextKeyboardButton: UIButton!
var button11: UIButton!
var button12: UIButton!
var fFastBoot = true
var fPri = CGFloat(20)
var ifontSize = 18.0
var RPath = ""
// Portrait表示におけるキーボードの高さ
private var portraitHeight: CGFloat = 190.0
private var portraitWidth: CGFloat!
// Landscape表示におけるキーボードの高さ
private var landscapeHeight: CGFloat = 100.0
private var landscapeWidth: CGFloat!
override func updateViewConstraints() {
super.updateViewConstraints()
}
var realmPath: String {
let containerURL = NSFileManager().containerURLForSecurityApplicationGroupIdentifier("group.AppGroupKeyboard")
return containerURL!.URLByAppendingPathComponent("test.realm").path!
}
override func viewDidLoad() {
super.viewDidLoad()
let pas = realmPath
print(pas)
// Perform custom UI setup here
・・・
let inputText = "か"
print("test1")
let realm = try! Realm()
print("test1.5")
let results = realm.objects(dic)
.filter("yomi BEGINSWITH %@", inputText)
.sorted("date", ascending: false)
print("test2")
for result in results {
print(result)
}
print("test3")
}
・・・