Recent

Author Topic: [SOLVED] NSDictionary error incompatible type for arg1  (Read 919 times)

josh

  • Hero Member
  • *****
  • Posts: 817
[SOLVED] NSDictionary error incompatible type for arg1
« 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

« Last Edit: June 12, 2021, 03:00:32 pm by josh »
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 881
Re: NSDictionary error incompatible type for arg1
« Reply #1 on: June 12, 2021, 02:45:39 pm »
Try adding {$modeswitch objectivec2} at the top of your program (but below any {$mode xxx} directives).

josh

  • Hero Member
  • *****
  • Posts: 817
Re: NSDictionary error incompatible type for arg1
« Reply #2 on: June 12, 2021, 03:00:11 pm »
Thanks that solved the problem.
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

 

TinyPortal © 2005-2018