Can you post all of the code in the function with this error? It seems likely that something on a line before or after this one is the actual cause of the error
I am pretty sure this is a API 2.0 issue… The entire project was written well before 2.0. I thought I could just access System.Device… but it will not compile with Simple References turned on. So I am in 2.0 hell. If I turn off Simple References then I can use System.Device but then I get over a 100 other errors I have to deal with.
Ah. Did you download the latest version of iOSKit and replace the version in your project with that? That should resolve any iOSKit related API2 errors.
To recreate the problem you have to start with an old iOS project… probably one created using a pre-API 2 version of Xojo…
When you open that project with a newer version of Xojo (probably one that supports API 2) on the Build Settings → Shared settings you will see the option “Simple References”. If that is turned on the System.Device. will not compile… But if you turn off “Simple References” then it will compile.
If the project was created with a newer version of Xojo there is no “Simple References” option.
For this old project turning “Simple References” off creates over a hundred other errors… which I can fix… but it was easier in my case to use declares to get the System.Device values I needed.
@Paul_Lefebvre, I’m just wondering if a new API 2.0 iOS Mobile Project could be a bug, looking at the following screenshot. But maybe it has to do with the fact that the BatteryState = Unknown (0).
Simple References is gone for good in API 2. Because Xojo used the same names for things in the namespaced vs non-namespaced things, the compiler couldn’t tell the difference between Folderitem and Xojo.IO.folderitem when your code looked like this:
Yes Greg… Simple References are gone… but if you have a project that was created before API 2 then the option is still there and it causes problems with at least System.Device…