Re: Upper limit to how large an NSString (from url) can be?
Re: Upper limit to how large an NSString (from url) can be?
- Subject: Re: Upper limit to how large an NSString (from url) can be?
- From: John Eriksson <email@hidden>
- Date: Mon, 26 Apr 2004 23:51:39 +0200
Hi again. Don't know what's wrong with [NSString
stringWithContentsOfURL:surl],
but it really does choke or something when the string is too large
(megabytes), I
switched to NSURL and NSURLHandle and now everything works... the
convenience
method of NSString was really nice, but perhaps it's supposed to be
done with NSURL
and NSURLHandle if I want to fetch larger amounts of data...?
/John Eriksson
My previous mail:
Hi.
I'm new to the list so hello everyone. I'm also a beginner when it
comes to Cocoa,
so this might be stupid.
To learn a bit of Cocoa I set out to create a small app that could send
database
queries to a script on a webserver which then returns the result.
I return the result as XML by the way, and found that Cocoa has VERY
basic xml-
support... where's xpath, where's DOM where's anything? I ended up
using
the IconaraDom which has proved sufficient, though I couldn't get xpath
working...
So I have a textView and a tableView (which uses an NSArray with
dictionaries as
datasource) so I can see the plain text being returned and also get a
tableview of
the data which is nice.
Everything works very well except one thing, I must keep the rows
returned under
4000 (or something like that) otherwise the NSString becomes nil.
This is the code for sending and receiving the db answer(it's executed
in a separate
thread):
- (void)executeQuery
{
NSAutoreleasePool * pool;
pool = [[NSAutoreleasePool alloc] init];
NSNotificationCenter *nc=[NSNotificationCenter defaultCenter];
//NSLog(@"responseString retainCount: %hu",[responseString
retainCount]);
[responseString release];
responseString=[[NSString stringWithContentsOfURL:surl]
stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[responseString retain];
[nc postNotificationName:@"SCResponseAvailable" object:self];
[pool release];
}
Here responseString becomes nil if the data returned is too large...
why is that? I've verified that
the script on the server does return the rows through a browser so the
problem isn't on the server.
/John Eriksson
_______________________________________________
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.
_______________________________________________
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.