Error when creating sample database. Obj C

18 views
Skip to first unread message

Imee Cuison

unread,
Jul 8, 2015, 6:50:58 AM7/8/15
to spar...@googlegroups.com
I am new to Sparksee and trying to follow the instructions for the sample database.

I keep getting this error:  


Terminating app due to uncaught exception 'IOException', reason: 'File cannot be created'

*** First throw call stack:

(

0   CoreFoundation                      0x000000011062ec65 __exceptionPreprocess + 165

1   libobjc.A.dylib                     0x00000001102c7bb7 objc_exception_throw + 45

2   SparkseePractObjC                   0x000000010facf9ae _wrap_sparksee_gdb_STSPlatformStatistics_getNumCPUs + 0

3   SparkseePractObjC                   0x000000010faf670e _wrap_sparksee_gdb_STSSparksee_create + 623

4   SparkseePractObjC                   0x000000010fb260fe _ZNSt3__113__vector_baseIPN8sparksee3gdb5ValueENS_9allocatorIS4_EEED2Ev + 34620

5   SparkseePractObjC                   0x000000010f9ad30d main + 205

6   libdyld.dylib                       0x0000000112b26145 start + 1

7   ???                                 0x0000000000000001 0x0 + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException


This is the line of code that xcode highlights:

STSDatabase *db = [sparksee create: @"HelloSparksee.gdb" alias: @"HelloSparksee"];

Any help is greatly appreciated!



c3po.ac

unread,
Jul 8, 2015, 8:10:58 AM7/8/15
to spar...@googlegroups.com, imeet...@gmail.com
Hi,

Sparksee must be able to write the given sparksee database file and other additional files in the same directory.

If you are using iOS, the default directory is not writable, so you should first get a directory where you can create the database:

- (NSString *) applicationDocumentsDirectory
 
{
     
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
     
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
     
return basePath;
 
}


And then use this directory for all the files:

NSString *workDir = [self applicationDocumentsDirectory];
NSString *dbFile = [workDir stringByAppendingString: @"/HelloSparksee.gdb"];
NSString *logFile = [workDir stringByAppendingString: @"/HelloSparksee.log"];
 
STSSparkseeConfig *cfg = [[STSSparkseeConfig alloc] init];
[cfg setLogFile: logFile];
[cfg setLicense: @"XXXXX-XXXXX-XXXXX-XXXXX"];
STSSparksee *sparksee = [[STSSparksee alloc] initWithConfig: cfg];
STSDatabase *db = [sparksee create: dbFile alias: @"HelloSparksee"];

Best regards.


El dimecres, 8 juliol de 2015 12:50:58 UTC+2, Imee Cuison va escriure:
Reply all
Reply to author
Forward
0 new messages