Search Results

Search found 3 results on 1 pages for 'jkap'.

Page 1/1 | 1 

  • NSURL Connection will/won't load data

    - by jkap
    So here's my issue: I followed the NSURLConnection tutorial in the iPhone Developer Documentation almost to the T, and it only kinda works. Here's where it all goes wrong: The object seems to be created correctly and delegates to connectionDidFinishLoading, but with any URL I try to load the response data always ends up only being 0 bytes. I am running in the simulator if that makes any difference. Here's my relevant code: - (void)viewDidLoad { [super viewDidLoad]; self.title = @"WVFS Player"; //create a request NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://wvfs.josh-kaplan.com/nowPlaying.php"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; // create a connection NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if(theConnection) { // create the datum responseData=[[NSMutableData data] retain]; } else { // code this later } } - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [responseData setLength:0]; } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { // make it work NSLog(@"Succeeded! Received %d bytes of data:",[responseData length]); // release it [connection release]; [responseData release]; } And here's my log output: [Session started at 2010-03-14 09:01:09 -0400.] 2010-03-14 09:01:14.784 WVFS[19571:207] Succeeded! Received 0 bytes of data: Any ideas? Thanks, Josh

    Read the article

  • NSNumber >= 13 won't retain. Everything else will.

    - by jkap
    The code I'm currently working on requires adding an NSNumber object to an array. All of the NSNumbers with value 0-12 are added fine, but 13 onward causes a EXC_BAD_ACCESS. I turned on NSZombieEnabled and am now getting *** -[CFNumber retain]: message sent to deallocated instance 0x3c78420. Here's the call stack: #0 0x01eac3a7 in ___forwarding___ #1 0x01e886c2 in __forwarding_prep_0___ #2 0x01e3f988 in CFRetain #3 0x01e4b586 in _CFArrayReplaceValues #4 0x0002a2f9 in -[NSCFArray insertObject:atIndex:] #5 0x0002a274 in -[NSCFArray addObject:] #6 0x00010a3b in -[Faves addObject:] at Faves.m:24 #7 0x000062ff in -[ShowController processFave] at ShowController.m:458 #8 0x002af405 in -[UIApplication sendAction:to:from:forEvent:] #9 0x00312b4e in -[UIControl sendAction:to:forEvent:] #10 0x00314d6f in -[UIControl(Internal) _sendActionsForEvents:withEvent:] #11 0x00313abb in -[UIControl touchesEnded:withEvent:] #12 0x002c8ddf in -[UIWindow _sendTouchesForEvent:] #13 0x002b27c8 in -[UIApplication sendEvent:] #14 0x002b9061 in _UIApplicationHandleEvent #15 0x02566d59 in PurpleEventCallback #16 0x01e83b80 in CFRunLoopRunSpecific #17 0x01e82c48 in CFRunLoopRunInMode #18 0x02565615 in GSEventRunModal #19 0x025656da in GSEventRun #20 0x002b9faf in UIApplicationMain #21 0x00002498 in main at main.m:14 If it wasn't isolated to NSNumbers of a certain range, I'd assume I screwed something up with my memory management, but I've just got no idea. Any ideas? Thanks, Josh

    Read the article

1