我有以下代码:
Sub Transform()
'
' Transform Macro
'
Dim Data As Worksheet
Set Data = Worksheets("Data")
Application.ScreenUpdating = True
Dim i, j As Long
For i = 16 To 25
For j = 3 To 26
'transposing cells for cavity numbers
If Cells(j, "K").Value = Cells(2, i).Value Then
Cells(j, "A").Resize(, 10).Copy
Data.Cells(3, i).End(xlUp).Offset(1).PasteSpecial Transpose:=True _
End If
Next j
Next i
End With
sheet1.Activate
MsgBox "Gage Measurement Sample Information Compiled"
我在class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
var config = Realm.Configuration()
config.fileURL = config.fileURL!.URLByDeletingLastPathComponent?
.URLByAppendingPathComponent("HelloWorld.realm")
Realm.Configuration.defaultConfiguration = config
return true
}
中设置了Realm的默认名称。但是,当我在ViewController中创建一个新的Realm对象时,这个名称/配置没有被加载:
AppDelegate
也许是因为我的ViewController领域是一个拥有它自己状态的新对象。如果是这样的话,我应该制作单身人士吗?如果我这样做,那就意味着我无法处理对数据库的异步写入。
答案 0 :(得分:2)
您的配置没有任何问题,您可以更改创建方式。
var realm :Realm!
override func viewDidLoad() {
super.viewDidLoad()
realm = try! Realm()
//The config (HelloWorld.realm) is printed
print(realm.configuration)
}
或
let realm = try! Realm()
使用成员var的git remote show shared
可能会导致错误
希望它有所帮助:D