Re: NSURLConnection how to handle 502 error
I am still trying to find a solution to quickly resolve the web server 502 error using NSURLRequest and NSURLConnection. Right now, even if i set timeoutinterval to 5 seconds, it takes 30 seconds. But more painful thing is that during that time, it makes the app unresponsive with the beach ball spinning. Let me know your strategies to handle 502 error. I would like something like Safari, it does take time (60-90 sec) to display the error message, but it doesn't halt the user's interaction with other tabs or windows of safari. Alternately, is there a way to specify a strict time duration for a particular action to execute and return nil if it can't. Thanks. -Original Message- From: [EMAIL PROTECTED] To: cocoa-dev@lists.apple.com Sent: Sun, 6 Jul 2008 4:25 am Subject: NSURLConnection timeoutInterval only works in multiples of 30 seconds Hi, I am trying to do a periodic update (every 1 minute) based on the contents of a url, but when the website is down with 5** error, I would like to not wait more than a couple of seconds. So, I wrote the following code : url = [NSURL ...]; updateTimer = [[NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(update:) userInfo:nil repeats:YES] retain]; [updateTimer fire]; -(void)update:(id)sender { NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:5]; NSURLResponse *urlResponse; NSLog(@ Before ); NSData *urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:urlResponse error:error]; NSLog(@ After : Error = %@ ,error); . . } But when i run the app, the After statement with timed out message is logged after 30 seconds from the Before statement. When I set the timeoutInterval between 30.1 to 59.9, it is printed after 60 seconds and so on. I don't know how to get it to work in desired time intervals. Any help would be appreciated. Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Key equivalents for an action without a visible object item
Thanks Michael, I had deleted that MainMenu NSMenu from the MainMenu.nib thinking I didn't need it as I had another NSMenu statusItem for my app. But putting it back from an empty project's nib file solved the issue. Now the textFields accept cut,copy and paste key equivalents and since i have set LSUIElement to 1, the Application-Menu doesn't appear. -Original Message- Message: 5 Date: Sat, 5 Jul 2008 21:27:55 -0400 From: Michael Ash [EMAIL PROTECTED] Subject: Re: Key equivalents for an action without a visible object item To: Cocoa Developers cocoa-dev@lists.apple.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=UTF-8 On Sat, Jul 5, 2008 at 8:14 PM, Kanny [EMAIL PROTECTED] wrote: Is it possible to define a key-equivalent for an action like in NSMenuItem but without any visible object ? The situation is like this: I have a NSTextField in nib file of my Application-Menu-less menubar app. I want it to receive Command-v for 'paste', but since I don't have/want a menuItem to connect to FirstResponder's paste method, it doesn't react in any way to Command-v. However the textfield is able to receive paste method by Control-clicking and selecting from the system-wide contextual menu. I don't know what a menubar app is, but if it's anything like an LSUIElement app then you can just create the menu item like you normally would. The menu bar doesn't appear, but any time the app is frontmost the key equivalents still function. Mike -- ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Key equivalents for an action without a visible object item
Is it possible to define a key-equivalent for an action like in NSMenuItem but without any visible object ? The situation is like this: I have a NSTextField in nib file of my Application-Menu-less menubar app. I want it to receive Command-v for 'paste', but since I don't have/want a menuItem to connect to FirstResponder's paste method, it doesn't react in any way to Command-v. However the textfield is able to receive paste method by Control-clicking and selecting from the system-wide contextual menu. I tried to look for NSKeyBindingManager, but there isn't any documentation for that. Alternately, is there a method to capture the key-strokes while in the textfield without having to define a custom class of NSResponder ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]