Method is protected. It can only be called from within its class.

I have a project that keeps giving me this message.

This method is protected. It can only be called from within its class.

I am using classes from iOSKit. The first time I started getting this message it was on NSArray. I deleted the one in my project and replaced it with the one from iOSKit. Then I started getting the same message, but now on NSDictionary. So I deleted and replaced it. Now I’m getting it on NSMutable Dictionary.

Has anyone seen this before and have any hints on how to fix it. I’d hate to try and rebuild this project only to end up in the same place again.

Thanks.

[quote=254882:@Kevin Windham]I have a project that keeps giving me this message.

This method is protected. It can only be called from within its class.

I am using classes from iOSKit. The first time I started getting this message it was on NSArray. I deleted the one in my project and replaced it with the one from iOSKit. Then I started getting the same message, but now on NSDictionary. So I deleted and replaced it. Now I’m getting it on NSMutable Dictionary.

Has anyone seen this before and have any hints on how to fix it. I’d hate to try and rebuild this project only to end up in the same place again.

Thanks.[/quote]

Select the method and make it Public or Global in the Inspector. That should do it.

They are all global already. I think it’s some kind of corruption or some other part of the project that’s triggering it, but I don’t know what it is.

Also, the project was compiling and running with those same classes before. I tried to move over the notification classes from iOSLib and I had to make some modifications to fit them in, so I think the problem is related to those classes, but I can’t find any correlation between them and the errors I’m getting.

I can delete and replace the class with the error and it just moves to a different one without me changing any code. It’s quite odd. Maybe I should submit the whole project in a Feedback

Contact @Ulrich Bogun who developed iOSLib.

That error also shows up if the method you are calling is Private. Check the signature to make sure you are calling the version you think you are.

Are you using the most recent versions of both libraries? With older versions there were several compatibility issues with module and constant names and this caused the error you are seeing.

I believe I’m using the latest versions. I’ve synced them both from github. It’s probably something I’m doing somewhere I’m just having a really hard time finding it. The error just points to the class itself and doesn’t seem to indicate an actual method, and when searching the project I don’t find any conflicts with the particular class it flags. I’ve saved the project as XML so I can search it manually to see where all occurrences of the particular class name are, but I don’t see any problems. Not to mention if I delete the one class it just gives me a new error on a different class. I’ve even unprotected all the protected methods and still get the error.

I’ll find it eventually, but I think it will take a while trying to isolate things because so many of these classes are dependent on other classes. Once I start stripping things I’m going to have to fix a lot of stuff to get it to compile so I know the errors are gone. Fun times.

Have you changed Xojo version ? If so, have you tried with the previous version ?

It’s happening in multiple versions of Xojo.

I’ve commented out some things and changed the order of some classes to see if that would help me narrow down the conflicting code and I thought it was going to compile when I got another error on a specific declare. So I figured I would just comment it out and this is the new line of code highlighted in the error.

'Declare Function dlerror Lib "/usr/lib/libSystem.dylib" () As CString

It’s now flagging a comment as an error. I think I’m just going to have to start a project from scratch and add things back in until it fails. I feel like I’m being led on a goose chase trying to track it down through the error messages.

Be careful how you are adding the classes to your project. If memory serves, there is a harness project in the repo that you should open to copy and paste iOSKit into your own project. If you drag the files directly from disk into your project, you will see odd errors.

The OP mentions using iOSLib, then switching to iOSKit. Mixing the two is probably a good recipe for conflicts. Given the remarkable support provided by Ulich or Jason, I would be inclined to stay with one, and bring the problem to them first, before experimenting haphazard combinations.

As the calls differ, switching appears like augmenting the chances of errors.

Maybe restarting from scratch is the way after all.

I rebuilt the project from scratch. I copied the main folders from both iOSKit and iOSLib into the project and no more weird errors. The only error was from a reference to an image file which I didn’t copy over. I just commented that line out and it seems good now.

We have worked pretty hard together to make sure that they are mutually compatible. If you have any trouble with a newer version of the repos not meshing properly, please let us know so we can fix it.