Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FSCopyObjectASync Not Calling Callback In Cocoa



I execute this code and it successfully copies my file from source to destination:

- (IBAction)startCopy:(id)sender;
{
    FSFileOperationRef fileOp = FSFileOperationCreate(NULL);

    FSRef source;
    FSRef destination;

FSPathMakeRef( (const UInt8 *)[[sourceFilePath stringValue] cStringUsingEncoding:NSUTF8StringEncoding], &source, NULL );
Boolean isDir = true;
FSPathMakeRef( (const UInt8 *)[[destinationFilePath stringValue] cStringUsingEncoding:NSUTF8StringEncoding], &destination, &isDir );



OSStatus status = FSCopyObjectAsync (fileOp, &source, &destination, NULL, kFSFileOperationDefaultOptions, statusCallback, 1.0, NULL);

    CFRelease(fileOp);

    if( status )
        NSLog(@"Status: %@", status);
}


status returns with no error. However my callback never gets called. Here's the callback.


static void statusCallback (FSFileOperationRef fileOp,
                                  const FSRef *currentItem,
                                  FSFileOperationStage stage,
                                  OSStatus error,
                                  CFDictionaryRef statusDictionary,
                                  void *info
)
{
    NSLog(@"Callback got called.");
    if (statusDictionary)
    {
        CFNumberRef totalBytes, bytesCompleted;

bytesCompleted = (CFNumberRef) CFDictionaryGetValue(statusDictionary, kFSOperationBytesCompleteKey);
if (bytesCompleted)
{
fprintf(stderr, "\tbytesCompleted: ");
CFShow(bytesCompleted);
}


totalBytes = (CFNumberRef) CFDictionaryGetValue(statusDictionary, kFSOperationTotalBytesKey);
if (totalBytes)
{
fprintf(stderr, "\ttotalBytes: ");
CFShow(totalBytes);
}


    }
}


Any idea why?

Thanks.

-Matt
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.