I have just spent about a month revising my App to work with 2021r3 which was originally written in 2019r2.1. I thought it would be nice to debug on the device which I saw was part of the new update. I now have 1106 errors after updating. Going back to 2021r3 with the same results. I spent nearly a year on this App and was forced to update by Apple recently and of course Xcode and Xojo had to be updated as well. I’m thinking that instead spending another month or so chasing bugs and rewriting the App once again my time would be better spent learning Swift. Obviously the errors are to numerous to post here but if anyone has a hint as what I can do to undo this disaster it would be much appreciated other wise I’ll consign my App to the trash heap.
How about you pick a few of the errors, and post them here along with the code they refer to.
I believe I know exactly what happened.
In 2019rX you had the simple references option turned on.
You opened the project in 2021rX and used Save As…
Which has turned off simple references and the option is now hidden.
I understand the feeling, I’ve been there too for all my projects. I even had over 3000 errors in one of them.
The good news is that most errors can be fixed using Search & Replace.
It took me 2-3 hours to fix all errors, but I had more errors than you have.
What are “simple references”?
It is a shared build setting that is now deprecated and hidden for new iOS projects.
Using File Menu > Save As… in an old project will turn the setting off and hide it.
It might be best to try some screen shots Tim. Stand by.
As I said.
Most errors will be easy fix using Search & Replace:
- Search for “Date” (option: full word), replace with “Xojo.Core.Date”
- Search for “Timer.Modes” replace with “Xojo.Core.Timer.Modes”
- Search for “As Folderitem” replace with “As Xojo.IO.Folderitem”
Thanks Jeremie, that’ll be a good start I think. This is out of left field. It was running just fine until I tried to run it under the latest update and I had it saved under the previous version just minutes before.
Hmmm. I thought xojo.anything was deprecated now. Or is that just for desktop, perhaps.
I stopped using Text and xojo.* for my Desktop app at least 3 years ago.
Yes it is deprecated. But doesn’t mean one can’t use it anymore.
Let’s try not to confuse the OP even more.
The easy way to fix the project is to add the Xojo.anything namespace where the compiler expects it.
Using be less work?
It wouldn’t. The reality is that when the API 2 changes came into play, the Using statements caused conflicts between things like Xojo.IO.Folderitem and the global FolderItem class. If the compiler can’t tell the difference, your app won’t compile. The only solution is to use the specific types going forward.
Thank you for all the helpful responses. I’m down to a manageable 93 errors from 1106. Two are still vexing me however:
Dim NewFile4 as Text= "ColorSchemes.sqlite" Dim dbFile As FolderItem dbFile=SpecialFolder.Documents.Child(NewFile4) If dbFile.Exists Then App.SchemesDB=New iOSSQLiteDatabase App.SchemesDB.DatabaseFile=dbFile
with the following error:
Type mismatch error. Expected class Xojo.IO.FolderItem, but got class FolderItem
Dim dbFile As Xojo.IO.FolderItem
does not resolve the error
The other is similar using MemoryBlock to store an image in sqlite database as follows:
dim Pic1 as MemoryBlock Dim imgMB as MemoryBlock Dim PartsPhoto as iOSImage=ImageView1.Image //If there's no Picture present then save nothing If ImageView1.Image=ColorCamera31 Then imgMB=Nil else imgMB=PartsPhoto.ToData("public.jpeg") end
Type mismatch error. Expected class MemoryBlock, but got class Xojo.Core.MemoryBlock
I’d appreciate a few more hints to resolve these two issues.
In that first error, does the line number change when you change the folderitem type?
I suspect it does and that you’ll need to change iOSSQLiteDatabase to just SQLiteDatabase as well.
Yes it does Greg. It throws the error at line 68 when I change to Xojo.IO.FolderItem where before it was at line 72.
Tried changing from iOSSQLiteDatabase to just SQLite Database which introduced another 12000 + errors. Yes, over 12,000. That’s not a typo.
It seems that all the sql statements and all associated types such as RecordSet, Field and TextValue are no longer valid. I’m stumped here.
You should take a look at the Xojo Documentation. I’ll give you information about the replacements for the deprecated classes.
Have you tried
dbFile = Xojo.IO.SpecialFolder.Documents.Child(NewFile4)
Not sure if it helps but it might be worth a try.
Dim dbFile as Xojo.IO.FolderItem