Mailing Lists: Apple Mailing Lists

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

Re: NSURLConnection



On 20 Feb 2008, at 23:17, Micah Walter wrote:

If I set this up in a standard Cocoa app, it works just fine, but in an Aperture plugin, the delegate handlers don't get called unless you click cancel or export on the plugin... I tried doing it in a new thread, but that didnt seem to work either... unless I just did it wrong..


NSURLConnection doesn't work in a modal runloop, such as Aperture plugins exist within. You have two choices:

1. Don't use NSURLConnection. cURLHandle (or the bare C cURL API) might be another possibility for you.

2. Interact with NSURLConnection in a background thread. This is what FlickrExport does:

- Spawns a new thread to a selector which starts the NSURLConnection
- Receives the NSURLConnection callbacks in the background thread
- Notifies the main thread by calling - performSelectorOnMainThread:withObject:waitUntilDone:inModes: with whatever data you want out of the NSURLConnection.


It's a pain, but it does work. If you can require Leopard, I believe there is some new stuff in NSURLConnection that makes it possible to schedule them on modal runloops.

HTH,
Fraser
--
http://speirs.org -- http://connectedflow.com


_______________________________________________ Do not post admin requests to the list. They will be ignored. Aperture-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/aperture-dev/email@hidden

This email sent to email@hidden
References: 
 >NSURLConnection (From: Micah Walter <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.