Эх сурвалжийг харах

Update README

Fix Swift code sample so that it doesn't try to do `stringByAppendingPathComponent` on `String` object (because that method no longer exists). You can use `NSString` or shift to use `NSURL` pattern as suggested here.
Robert M. Ryan 10 жил өмнө
parent
commit
64c9266a78
1 өөрчлөгдсөн 3 нэмэгдсэн , 3 устгасан
  1. 3 3
      README.markdown

+ 3 - 3
README.markdown

@@ -283,10 +283,10 @@ To do this, you must:
 If you do the above, you can then write Swift code that uses FMDatabase. For example:
 If you do the above, you can then write Swift code that uses FMDatabase. For example:
 
 
 ```swift
 ```swift
-let documentsFolder = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as String
-let path = documentsFolder.stringByAppendingPathComponent("test.sqlite")
+let documents = try! NSFileManager.defaultManager().URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: false)
+let fileURL = documents.URLByAppendingPathComponent("test.sqlite")
 
 
-let database = FMDatabase(path: path)
+let database = FMDatabase(path: fileURL.path)
 
 
 if !database.open() {
 if !database.open() {
     println("Unable to open database")
     println("Unable to open database")