Lazarus

Programming => Operating Systems => macOS / Mac OS X => Topic started by: josh on June 12, 2021, 02:37:09 pm

Title: [SOLVED] NSDictionary error incompatible type for arg1
Post by: josh on June 12, 2021, 02:37:09 pm
https://wiki.freepascal.org/Mac_Show_Application_Title,_Version,_and_Company

Following the above article to create an about box; and at the line
dict := NSDictionary.alloc.initWithObjectsAndKeys(Val1, Key1, Val2, Key2, Val3, Key3, Val4, Key4, Val5, Key5, Nil);
I get error at Val1 : Incompatible type for arg no.1 got "nsstring" expected "id"

What have I done wrong, could not find other examples

Title: Re: NSDictionary error incompatible type for arg1
Post by: Jonas Maebe on June 12, 2021, 02:45:39 pm
Try adding {$modeswitch objectivec2} at the top of your program (but below any {$mode xxx} directives).
Title: Re: NSDictionary error incompatible type for arg1
Post by: josh on June 12, 2021, 03:00:11 pm
Thanks that solved the problem.
TinyPortal © 2005-2018