I created my unit with Lazarus File - New Unit and thus at the top of the unit I have the default
unit Unit1;
{$mode ObjFPC}{$H+}
But the code snippet errors until I replace the default with
unit u_PvUpload;
//{$mode ObjFPC}{$H+}
{$modeswitch objectivec1}
The code for GetSignificantDir was taken from an Apple web page (don't have a link to hand). While solving the problem in hand I did not try to understand the code, just use it. I had not realised that NSArray was an ObjectiveC construct, hence the error.
I am porting a Win VB6 program to MacOS and need to get Mac folders for /Library/Application Support, /Library Preferences for application managed data so I do not want the /User/Library locations. I was unable to find any other method to get them.
In hindsight my question(s) should have been
1. Will using {$modeswitch objectivec1} cause me any problems later on as development continues?
2. Should I create a special unit for this function and procedures that depend on it so I can revert to the default {$mode ObjFPC}{$H+} for all the other code?