Hi Afriza, On Feb 1, 2011, at 4:16 AM, Afriza N. Arief wrote:
> On Tue, Feb 1, 2011 at 3:38 AM, Tito Ciuro <tci...@mac.com> wrote: > >> Hello, >> >> The following code snippet runs fine on Mac OS X, but fails on the iOS >> simulator: >> >> // Obtain a path for the database >> NSString *docs = >> [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, >> YES) lastObject]; >> NSString *path = [[docs stringByAppendingPathComponent:@ >> "myDB.sqlite"]fileSystemRepresentation]; >> >> // Open the database >> sqlite3 *db = NULL; >> int statusOpen = sqlite3_open_v2( fileSystemRepresentation, &db, >> SQLITE_OPEN_READWRITE | >> SQLITE_OPEN_CREATE | SQLITE_OPEN_AUTOPROXY | SQLITE_OPEN_FULLMUTEX, NULL); >> > > Do you need UTF8String for the sqlite3_open_v2() ? I don't think so. The fileSystemRepresentation method should we used when dealing with file-based paths. This is because the length of the encoded string in foreign file systems can be longer than the number of Unicode characters in the NSString. So, you would end up with a different length (a "wrong" string) by using UTF8String. Regards, -- Tito _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users