Compiler error when declaring a Delegate

I have been racking my brains on this problem for a few hours. I have a class to manage my iOS app settings. The class loads, saves and manages the access to number of settings. I added the ability to register notification subscribers to handle changes to settings. I’ve had issues with creating a arrays of delegates to I am using an array of pointers and then creating the delegate on the fly (see below) using the pointer. When I try and compile this I get a strange compiler error. Just a reference to the line but no description.

Delegate Sub SettingUpdateNotificationDelegate(settingName as Text)

Private Sub NotifySettingChangeSubscribers(settingField as Text)

for each p as Ptr in changeSubscribers
if ( p <> nil ) then
Var subscriber as new SettingUpdateNotificationDelegate§
subscriber.Invoke(settingField)
end if
next p

End Sub

Not sure if this DropBox link with work but this is a screen shot of the compiler error. Has anyone else experienced this with 2019R2?

https://www.dropbox.com/s/vhypss86g4zii0g/Screen%20Shot%202019-11-22%20at%209.40.56%20PM.png?dl=0

What’s the compiler error? I’m not sure it’s possible to use delegates and ptrs like that. You might have to use CType? But really you should just be using an array of delegates.

If you are using iOSKit checkout the Notification_Center module which provides a similar functionality for subscribing to arbitrary notifications that you generate yourself in other parts of the app.

Your changeSubscribers array should be of type SettingUpdateNotificationDelegate, not Ptr.