• 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
Why doesn't this work? (NSURL loadResourceDataNotifyingClient)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why doesn't this work? (NSURL loadResourceDataNotifyingClient)


  • Subject: Why doesn't this work? (NSURL loadResourceDataNotifyingClient)
  • From: Gerben Wierda <email@hidden>
  • Date: Thu, 28 Feb 2002 23:26:35 +0100

The rogram below is meant to demonstrate something I probably do not understand. The same behaviour i see in an AppKit app I am building).

The code contains a class (MyClient) that conforms to the NSURLHandleClient protocol. The methods do not do anything useful, but they NSLog their name. I load an URL with loadResourceDataNotifyingClient and give a created MyClient object as client. I expect the methods to display their Log messages, but they do not. Why does this notw ork?

G
=================== start file urltest.m
/* to compile:

cc -Wall -framework Foundation urltest.m -o urltest

*/

#define MYHTTPURL @"http://bloch.ling.yale.edu/~gerben/TeXLive-
bin.ii/TeXLive-bin.rtf"

#import <Foundation/Foundation.h>

@interface MyClient: NSObject<NSURLHandleClient> {
}
@end

@implementation MyClient
- (void)URLHandle:(NSURLHandle *)sender resourceDataDidBecomeAvailable:(NSData *)newBytes
{
NSLog(@"resourceDataDidBecomeAvailable");
}

- (void)URLHandleResourceDidBeginLoading:(NSURLHandle *)sender
{
NSLog(@"URLHandleResourceDidBeginLoading");
}

- (void)URLHandleResourceDidFinishLoading:(NSURLHandle *)sender
{
NSLog(@"URLHandleResourceDidFinishLoading");
}

- (void)URLHandleResourceDidCancelLoading:(NSURLHandle *)sender
{
NSLog(@"URLHandleResourceDidCancelLoading");
}

- (void)URLHandle:(NSURLHandle *)sender resourceDidFailLoadingWithReason:(NSString *)reason
{
NSLog(@"resourceDidFailLoadingWithReason");
}
@end

int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool;
NSURL *httpurl;
MyClient *client;

pool = [NSAutoreleasePool new];
client = [[MyClient alloc] init];
httpurl = [NSURL URLWithString:MYHTTPURL];

[httpurl loadResourceDataNotifyingClient:client usingCache:NO];
NSLog( @"loadResourceDataNotifyingClient");
getchar();
[pool release];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Multiple Line Help Tags
  • Next by Date: Re: Finding point on Bezier curve?
  • Previous by thread: Re: Clicking on a disabled ComboBox / FwUp: Window-closing sequence...
  • Next by thread: Contextual Menu not showing up in OLV
  • Index(es):
    • Date
    • Thread