I had a SQL script in a file, added to my Xcode project, and I want get its file path.
When I write the following:
switch (var){
case 1:
NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"triggers.sql"];
break;
I got the following error:
Expected expression
What am I doing wrong?
Thanks in advance.
To declare new variables inside a switch
statement you need to create a 'block' for them to exist in:
switch (var){
case 1:
{
NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"triggers.sql"];
...
break;
}
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With