ROAsyncRequestDelegate

Hi,
I am transfering files between server (delphi ) and client(Cocoa).
When I download , works easy with - (void)asyncRequest:(ROAsyncRequest *)request didReceiveDataSize:(int)size ofExpected:(int)totalSize;
but when I upload how I can get the progress , async.
I try to work with the ROClientChannelDelegate, but seems when I set the roasyncRequest 's delegate , the channel’s ROClientChannelDelegate never call.

Jason,

If the first callback works, then the delegate itself seems to be set correctly. Which callback is it that you are not receiving?

I want to use both upload and download with ROAsyncRequestDelegate, but I check with the ROAsyncRequestDelegate.h
only download version as - (void)asyncRequest:(ROAsyncRequest *)request didReceiveDataSize:(int)size ofExpected:(int)totalSize;
how I can hook the upload progress?
thanks.

There’s a corresponding didSend callback on the delegate that should provide that?

- (void)clientChannel:(ROClientChannel *)channel didSendDataSize:(int)    size ofExpected:(int) totalSize;
- (void)clientChannel:(ROClientChannel *)channel didReceiveDataSize:(int) size ofExpected:(int) totalSize;

I try this code that “print(size)” never called,
maybe I am using it with wrong way?

public class NDA_Att_UploadV2:ROClientChannelDelegate{

var rs : ROAsyncRequest?

 func upload(module:Int32, number:String,fileName:String,data:Data,
                             finished:@escaping (_ result:Bool)->()){
     rs = ServerAccess.sharedInstance.svFiles.beginAttach_Upload(PAModule.Cap_Sample.rawValue, number, fileName, data, start: false)
          rs?.channel.delegate = self
         rs?.start()
     }
    
 func clientChannel(_ channel: ROClientChannel!, didSendDataSize size: Int32, ofExpected totalSize: Int32) {
    print(size)
}

}

if I change to

public class NDA_Att_UploadV2:ROAsyncRequestDelegate{

var rs : ROAsyncRequest?

 func upload(module:Int32, number:String,fileName:String,data:Data,
                             finished:@escaping (_ result:Bool)->()){
     rs = ServerAccess.sharedInstance.svFiles.beginAttach_Upload(PAModule.Cap_Sample.rawValue, number, fileName, data, start: false)
       rs?.delegate = self
         rs?.start()
     }
    

public func asyncRequest(_ request: ROAsyncRequest, didReceiveDataSize size: Int32, ofExpected totalSize: Int32) {
    print(size)
}

}

that works good , but on ROAsyncRequestDelegate only have the receive version… , how I can get hook of the size did sent ? now I can only hook size did received…

Well, you asked about ROAsyncRequestDelegate ;).

For now, using that one is the proper fix; i’ll see if i can expose this on DAAsyncRequestDelegate too.

sorry, I typed wrong, it was ROAsyncRequestDelegate…

on the ROAsyncReuqestDelegate there are no didsent…
@protocol ROAsyncRequestDelegate

  • (void)asyncRequestDidComplete:(ROAsyncRequest *)request;

  • (void)asyncRequest:(ROAsyncRequest *)request didFailWithException:(NSException *)exception;

@optional

  • (void)asyncRequest:(ROAsyncRequest *)request didReceiveDataSize:(int)size ofExpected:(int)totalSize;

  • (void)asyncRequestWasCanceled:(ROAsyncRequest *)request;

  • (BOOL)asyncRequestNeedsLogin:(ROAsyncRequest *)request; // somewhat deprecated, you should use clientChanneNeedsLogin: instead

  • (void)asyncRequestWillBeginLogin:(ROAsyncRequest *)request; // somewhat deprecated, you should use clientWillBeginLogin: instead

  • (void)asyncRequestDidFinishLogin:(ROAsyncRequest *)request; // somewhat deprecated, you should use clientDidFinishLogin: instead

  • (void)asyncRequestWasSuspendedAwaitingLogin:(ROAsyncRequest *)request;

  • (BOOL)asyncRequest:(ROAsyncRequest *)request shouldAcceptUntrustedServerCertificate:(ROCertificateInfo *)cert;

@end

Yes, right now you will need to use ROClientChannelDelegate.

If I want to use the ROClientChannelDelegate, may I use the async version proxy? cause now,
when I use svFiles_AsyncProxy.beginUpload…,
the delecate never been called.
But with svFiles_Proxy.Upload. it works ok good.
so if I want to work with ROClientChannelDelegate, I can only use sync call , but not async right?

Hmm, good question. I would have thought the ROClientChannelDelegate would get callbacks for all calls, sync and async, done on that client channel, while the ROAsyncRequestDelegate gets the callbacks for one particular request only…

But let me upload a new build, RemObjects Data Abstract for Cocoa - 10.0.0.1524.dmg to your Personal Downloads that has my (untested!) changes to expose the new callback on the ROAsyncRequestDelegate as well…

Thanks for your quick reply,
I just try the download, but the asyncRequest(_ aRequest: ROAsyncRequest, didSendDataSize size: Int32, ofExpected totalSize: Int32) NOT called, the didCompele was called.

public func asyncRequestDidComplete(_ request: ROAsyncRequest!) {
    print(request.exception)
}

public func asyncRequest(_ aRequest: ROAsyncRequest, didSendDataSize size: Int32, ofExpected totalSize: Int32) {
    print(size,totalSize)
}

I replaced the folder Remobjects10/Binaries/Xcode/Debug/
and it was not called ,
just want to make sure I am not using the wrong directory , on header it showed that method and program can run,.
Thanks!

Hi mh,
do you think I am not using it with wrong file? or are you working on another version ?
the func asyncRequest(_ aRequest: ROAsyncRequest, didSendDataSize size: Int32, ofExpected totalSize: Int32) {
print(size,totalSize)
} did not called .
Thank you !

Not sure, I’ll have to test this myself tomorrow, I suppose. There’s only one new version, if you see the function in the header, you should have the version with the fix.

Do you have a very simple testcase that shows this, for me (ideally Obj-C) when I have a look tomorrow, just to make sure I’m looking at there same use-case as yours?

thanx!

maybe I can build a simple swift project to show you ? I know nothing about Obj-c , I can build a simple test project with swift , if you want. and where I should post the files?

Thanx, I will have a look.

I have to admit I’m a bit out of the loop with the intricacies of Apple Swift and the latest Xcode (as I try to avoid that hot mess Apple is making there, like the plague), but your project fails for me with

/Users/mh/Downloads/DATest/DATest/DAAccess.swift:9:8: No such module ‘DataAbstract’

even though DataAbstract.framework is in the right place, and I get no errors about not being able to find it. any ideas? Any chance of an Objective-C test-case?

you can just delete the 2 framework files( DataAbstract and RemObjectsSDK) on Navigator under " Frameworks. " then drag on the DA and ROSDK .xcframworks there(I was used the files under Binaries/Xcode/Debug), the project will be combined.
sorry, I was new to to lean Xcode since 2 years ago, and I was skipped the obj-C… don’t now how to make a obj-c project… sorry about it .