• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: FSCopyObjectAsync() under ARC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FSCopyObjectAsync() under ARC


  • Subject: Re: FSCopyObjectAsync() under ARC
  • From: David Duncan <email@hidden>
  • Date: Tue, 20 Sep 2011 17:11:28 -0700

On Sep 20, 2011, at 5:07 PM, Indragie Karunaratne wrote:

> I'm trying to use FSCopyObjectAsync() to copy a file and get progress callbacks to update my UI. The last parameter (clientContext) gets passed on to the callback. Under ARC, I can not pass self because the parameter has a void* type. Using (__bridge void*)self silences the compiler warning but it results in EXC_BAD_ACCESS. Is there any way to pass an object for this parameter under ARC?

If this is causing an EXC_BAD_ACCESS it is most likely because the object you are passing as the clientContext is being released out from under you. In general you should consider local references to an object as an implicit ownership reference within the current scope, so if nothing else has an owning reference to the object after the scope ends, the object will be deallocated. A __bridge cast specifically says "don't do anything with ownership for this object".
--
David Duncan

_______________________________________________

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: FSCopyObjectAsync() under ARC
      • From: Indragie Karunaratne <email@hidden>
References: 
 >FSCopyObjectAsync() under ARC (From: Indragie Karunaratne <email@hidden>)

  • Prev by Date: FSCopyObjectAsync() under ARC
  • Next by Date: Re: FSCopyObjectAsync() under ARC
  • Previous by thread: FSCopyObjectAsync() under ARC
  • Next by thread: Re: FSCopyObjectAsync() under ARC
  • Index(es):
    • Date
    • Thread