Import SQLClient into existing XCODE (swift) project -
i've never messed ios new me. i'm trying import sqlclient an existing xcode project. (i need fire off insert ios app.)
https://github.com/martinrybak/sqlclient
i've tried both installation methods listed martin via cocoapods , manual can't either work.
for option #1) worked fine until tried pod install , met
analyzing dependencies [!] dependency sqlclient (~> 0.1.3) not used in concrete target.
i expecting command produce file named sqlclient.xcworkspace. wasn't sure if new xcworkspace file meant replace main project xcode file. since didn't work, moved onto option #2.
for option #2 wasn't sure put contents. (does martin mean /sqlclient/sqlclient/sqlclient/sqlclient or /sqlclient/sqlclient/sqlclient?)
was supposed copy files or whole folder? contents go project @ same level original xcode project file or in subfolder? i've tried couple variations admittedly don't know sqlclient files/folders should placed in relation other project files.
i've tried messing bridge file i've been unable load it.
i have time (2 days) figure out i'm willing learn need guidance.
here's pic of existing xcode project , latest attempt import sqlclient.
it looks have files in project correctly.
things check.
if said yes create bridge file when dragged object-c file project need add #import "sqlclient.h" bridge file. if created bridge file manually make sure added build settings - objective-c bridging header.
make sure in target - general - linked framework , libraries have libiconv.tb , libfreetds.a
swift 3
class testviewcontroller: uiviewcontroller, sqlclientdelegate { // handles errors sqlclient func error(_ error: string!, code: int32, severity: int32) { print("\(error!) \(code) \(severity)") } //mark: lifecyle override func viewdidload() { super.viewdidload() let client = sqlclient.sharedinstance()! client.delegate = self client.connect("servernameorip", username: "cool", password: "cool", database: "database") { success in client.execute("select * table", completion: { (_ results: ([any]?)) in table in results as! [[[string:anyobject]]] { row in table { (columnname, value) in row { print("\(columnname) = \(value)") } } } client.disconnect() }) } } } created sample project here
Comments
Post a Comment