• 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: Problems getting NSURLConnection to work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems getting NSURLConnection to work


  • Subject: Re: Problems getting NSURLConnection to work
  • From: Nir Soffer <email@hidden>
  • Date: Sat, 9 Feb 2008 21:56:30 +0200


On Feb 9, 2008, at 17:08, Matthew Delves wrote:

Unfortunately not. I placed in a call to [super init] though that made no difference.

With the comments from your previous email, I have been scratching my head over a lot of it including using an NSMutableURLRequest and setting the url of it a second time. As far as threads are concerned, I've run in on the main thread and a seperate thread and get the same results.

Any suggestions would be greatly appreciated.

This is what I would:

1. Create a new cocoa app for testing, and setup an application delegate

2. Add this minimal code in the application delegate:

/* AppDelegate.h */

#import <Cocoa/Cocoa.h>

@interface AppDelegate : NSObject
{
	NSURLConnection *connection;
}
@end

/* AppDelegate.m */

#import "AppDelegate.h"

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)notification;
{
    NSURL *url = [NSURL URLWithString:@"http://www.apple.com/";];

	NSURLRequest *request = [NSURLRequest requestWithURL:url];

    connection = [[NSURLConnection alloc] initWithRequest:request
                                                 delegate:self];
    if (connection == nil) {
        NSLog(@"cannot create connection");
        return;
    }
}

-(void)connection:(NSURLConnection *)sender didReceiveResponse: (NSURLResponse *)response;
{
NSLog(@"received response");
}


@end

3. Compile and test

4. Add more features one by one: save received data, handle redirects, caching, etc.

5. When you finish, integrate with your app.


Best Regards,

Nir Soffer

_______________________________________________

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


References: 
 >Problems getting NSURLConnection to work (From: Matthew Delves <email@hidden>)
 >Re: Problems getting NSURLConnection to work (From: Nir Soffer <email@hidden>)
 >Re: Problems getting NSURLConnection to work (From: Nir Soffer <email@hidden>)
 >Re: Problems getting NSURLConnection to work (From: Matthew Delves <email@hidden>)

  • Prev by Date: Re: A build question...
  • Next by Date: Re: What's the replacement for GetMBarHeight?
  • Previous by thread: Re: Problems getting NSURLConnection to work
  • Next by thread: Re: Problems getting NSURLConnection to work
  • Index(es):
    • Date
    • Thread