login about faq

Is progress monitoring and abort capability available in iOS and MacOSX? I didn't find them.

asked Jul 17 '12 at 10:18

chilkat's gravatar image

chilkat ♦♦
11.8k316358421


Yes. To implement an event callback, your app would define and implement a class that inherits from one of the CkoProgress base classes. You provide method implementations to override the methods specified in the CkoProgress classes (see the header files). The callback object is specified via the EventCallbackObject property:

// property setter: EventCallbackObject
 - (void)setEventCallbackObject: (CkoFtp2Progress *)eventObj;

For example, here are sample source files for HTTP event callbacks:

MyHttpProgress.h:


#import "../workspace/chilkat/ObjectiveC/CkoHttpProgress.h"

@interface MyHttpProgress : CkoHttpProgress {

}

- (id)init; - (void)dealloc; - (void)dispose;

- (void)AbortCheck: (BOOL *)abort; - (void)PercentDone: (NSNumber *)pctDone abort: (BOOL *)abort;

@end

MyHttpProgress.mm:


#import "MyHttpProgress.h"

@implementation MyHttpProgress

-(id)init { self = [super init]; return self; }

-(void)dealloc { [super dealloc]; }

-(void)dispose { }

- (void)AbortCheck: (BOOL *)abort { *abort = NO; // Set this to YES to abort the operation in progress.

// Add your application code here...

} - (void)PercentDone: (NSNumber *)pctDone abort: (BOOL *)abort { *abort = NO; // Set this to YES to abort the operation in progress.

    // Add your application code here...

}

@end

link

answered Jul 17 '12 at 10:25

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Also, the AbortCheck event is standard to all classes that have event callbacks.

The HeartbeatMs property is the number of milliseconds between each AbortCheck callback. The default value is 0 to indicate that no AbortCheck events will be fired. You must set the HeartbeatMs property to a non-zero value to receive AbortCheck events. For example, a value of 100 sends 10 events per second.

Important: Many Chilkat methods allow for percent-done progress monitoring. Percent-done event callbacks also provide the ability to abort an operation. Therefore, AbortCheck events are suppressed when the frequency of percent-done callbacks is greater than the HeartbeatMs. The reason for this is to prevent too many callbacks from disrupting performance. If you used both percent-done and AbortCheck events, you should also code for aborting from the percent-done event.

link

answered Jul 17 '12 at 10:32

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

I can assure you that the event callbacks are happening during the call to DownloadFileByName. The problem is that (for some reason) your UI is not refreshing with whatever code you've provided in the event callback.

To prove that the event callbacks are happening during the call to DownloadFileByName, do the following:

1) Open a log file just prior to calling DownloadFileByName, write the line "About to call DownloadFileByName", and then close the log file.
2) In your event callback, open the same log file for append, write a line with information for the event callback, and close the log file.
3) Just after the call to DownloadFileByName, do the same: open the log file for append, write the line "Finished calling DownloadFileByName", and close the log file.

Run your app again. You'll find that the event callbacks lines appear between the lines logged just before and after the call to DownloadFileByName.

I'm sorry to say that providing general programming help for writing UI interfaces for IOS in Objective-C is not something Chilkat can do. I can help you in achieving the event callback, and that is already achieved. The final step is entirely application code (non-Chilkat) which involves using that information to update the UI. This is something for which I cannot help.

link

answered Aug 20 '12 at 13:48

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Ray,

I'm sorry to say it's not something that can be changed. Small files that upload or download very quickly will certainly not have callbacks for every 1% -- it's just not possible. The callbacks happen at fairly regular intervals, and it would be disruptive to make callbacks too frequently. (For example, if the entire download happens in 1 second, it's pointless to have more than a few callbacks.) However, for very large files, you should see PercentDone callbacks for every 1%.

link

answered Aug 21 '12 at 13:39

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×22
×19
×5

Asked: Jul 17 '12 at 10:18

Seen: 5,890 times

Last updated: Sep 02 '12 at 03:53

powered by OSQA