Good Morning in Spain.
First of all, thank you very much for the help.
The previous answer has helped me a lot and I have understood many things, but it still does not work, there is something that I do not do well or do not understand. What I do not understand is how I can have a project stopped for more than 1 month because I am not able to test an application on an iPhone physical device. An application that works correctly for me in xcode and everything is because of the database.
The steps I do are add the database to the project as indicated in the screenshots (photo1, photo2).Here I check that the database is really inside the project
Once this is done, I generate the database connection code, which is this
let fileURL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
.appendingPathComponent("TurMer.sqlite")
Once this line is executed, it tells me that everything is correct. Moving on to execute the second line which is
if sqlite3_open(fileURL.path, &BaseDatos) != SQLITE_OK
In this line we have opened the database. Everything is correct, it tells me that the database exists (for that I have created a breakpoint)
Ok, at this point, we have found the database and opened it. Up to here everything correct.
Now we are going to execute a query in said database. I do it with the following code
cadenasql="SELECT * FROM Clientes"
var stmt:OpaquePointer?
if sqlite3_prepare_v2(BaseDatos, cadenasql, -1, &stmt, nil) == SQLITE_OK
{
As you can see, it is a simple query to a database table. Well this is where I ALWAYS get the problem. Cannot find any tables in the database. The database has 8 tables, and it doesn't find any of them. And it is something that I do not understand, if we have found the database and we have opened it (and it has not given me any error), why does it not find ANY TABLE inside the database?
Always the same message ---> No much: ( name of table).
And I don't understand, I don't understand, I don't understand...why?????????
It's maddening. I have searched for countless forums, documents, etc on the internet and I follow the steps of all of them and always always the same error. Before it couldn't find the database, it already does, but it can't find the tables. I'm going crazy. I don't understand how it can cause so much trouble. I have programmed in other languages and none have given me so many problems ( c, cobol, assembler, pascal, python, R, java)... I'm about to forget all my project, please, any help... some point of light in the face of so much despair. thank you !!
Post
Replies
Boosts
Views
Activity
Yes, I am.
1.- My database is only read.
2.-
When I run the application in xcode, it shows me a route, there I copy
the database, I run the app in xcode and it works perfectly for me.
3.-
When I run the app on the iphone.
the problem is that I put that path /var/mobile/Containers... in the
"finder" and that path doesn't exist, so when the application is run
on the iPhone it doesn't physically find the database, that is where
my problem lies or is. The application cannot find the database.And
I'm going crazy for 1 month that I can't test the application on the
iphone.
I have the same problem for 2 months and I don't know what to do. I'm going crazy and I have stopped the project for 2 months and I can't find a solution. All the ones I have done have not worked for me. Please, can you explain me better, since I am a novice, how to do what you indicate... if you did it with screens much better. Thank you very much from Spain.
Hello AncientCoder.
I have the same problem , but now i don't find iTunes...help !!
thank yo u!!!!! it's works !!!!
Good Morning. I feel the delay in responding. I don't know what the canvas is, when you say .. "Thais is probably because the label is not selected in the canvas". I am new to programming and I don't understand canvas.
Good morning. Thanks in advance.I thought I had added a photo to my question, but I see no. In this photo, perhaps my doubt can be seen better.I have a label in a view.When I want to add constraint to this object, I click on the Add new constraint button (bottom right of the screen). I am supposed to like 4 fields in which I can put the distance of the object both at the top, bottom, left and right. Well, those fields and all others are deactivated, so I can't put any value, and I can't do anything with them. That is my problem, that I cannot put any constraint of this label nor of a second label that I have in the view.