Hello,
I’m trying to recreate the “SuperHTTPChat”-Client with oxygene. I’ve translated the objective-c code but the following exception will be raised:
!> Exception of type ROUnknownClassException on thread 10e41
!> Message: An exception of type: ROUnknownClassException occurred: Unknown class found in the stream: ChatEvents_EventInvoker
!> (null)
I do exactly the same like in the Xcode sample.
The ChatEvents_EventInvoker
class is definitely implemented in the ChatServerLibrary_Intf.pas
ChatEvents_EventInvoker = public class(ROEventInvoker)
public
method Invoke_Message(aMessage: ROMessage) handler(aHandler: Object): Boolean;
method Invoke_UserLogin(aMessage: ROMessage) handler(aHandler: Object): Boolean;
method Invoke_UserLogout(aMessage: ROMessage) handler(aHandler: Object): Boolean;
end;
Any ideas?
Thanks!
Benjamin
namespace SuperHTTPChat;
interface
uses
Foundation,
RemObjectsSDK;
type
ServerAccess = public class(IROClientChannelDelegate, IChatEvents)
private
class var _sharedInstance: nullable ServerAccess;
class method get__sharedInstance: not nullable ServerAccess;
public
chatProxy: ChatServerService_AsyncProxy;
loginProxy : LoginService_Proxy;
eventReceiver : ROEventReceiver;
class property sharedInstance: not nullable ServerAccess read get__sharedInstance;
property serverURL: not nullable NSURL := NSURL.URLWithString("http://172.28.17.233:8099/bin") as not nullable; readonly;
method Message(&From: String; Target: String; Message: String);
method UserLogin(Nickname: String);
method UserLogout(Nickname: String);
method registerUser(aUserName: String);
end;
implementation
class method ServerAccess.get__sharedInstance: not nullable ServerAccess;
begin
if not assigned(self._sharedInstance) then
begin
self._sharedInstance := new ServerAccess();
end;
exit self._sharedInstance as not nullable;
end;
method ServerAccess.registerUser(aUserName: String);
begin
var message := new ROBinMessage;
var channel := new ROSuperHTTPClientChannel;
channel.targetURL:= serverURL;
eventReceiver := new ROEventReceiver;
eventReceiver.channel := channel;
eventReceiver.message := message;
eventReceiver.serviceName := 'ChatServerService';
eventReceiver.registerEventHandler(self);
eventReceiver.active := true;
loginProxy := new LoginService_Proxy withMessage(message) channel(channel);
chatProxy := new ChatServerService_AsyncProxy withMessage(message) channel(channel);
loginProxy.Login(aUserName);
end;
method ServerAccess.Message(&From: String; Target: String; Message: String);
begin
writeLn(&From+' '+Target+' '+Message);
end;
method ServerAccess.UserLogin(Nickname: String);
begin
writeLn('Login: '+Nickname);
end;
method ServerAccess.UserLogout(Nickname: String);
begin
writeLn('Logout: '+Nickname);
end;
end.
This is the little sample. As soon as any chat member writes a message, the app will crash with the above exception.
mh
(marc hoffman)
March 20, 2017, 11:35am
3
Is ChatEvents_EventInvoker
declared in your own code, or in an auto-generated Into file? In the former case, can you try adding an [objc]
attribute to it to disable type name mangling?
—marc
1 Like
No, it is declared in an auto-generated Inft-file. But adding the [objc] to the declartion works anyway Thanks!
mh
(marc hoffman)
March 20, 2017, 12:22pm
5
Thanx. i’ll make sure the codegen gets fixed for the next beta, then.