• 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
NSURL resourceDataUsingCache: method hangs only during unit-test - 2.4
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSURL resourceDataUsingCache: method hangs only during unit-test - 2.4


  • Subject: NSURL resourceDataUsingCache: method hangs only during unit-test - 2.4
  • From: Steve Byan <email@hidden>
  • Date: Wed, 18 Jun 2008 18:44:48 -0400

I'm still on 10.4.11 and Xcode 2.4.1. I created a Foundation Tool project to experiment with NSXMLParser and set up dependent unit tests. 

The basic unit-tests work fine, but when I added a test that invoked:

NSXMLParser * theParser = [[NSXMLParser alloc] initWithContentsOfURL: myStationURL];

the unit-tests hung.

After some exploration, I've found that NSURL resourceDataUsingCache: seems to hang during unit-test, but not when the Foundation Tool is executed via the Debug->Run Executable menu item.

Here's the pertinent code snippet:

- (id) fetch
{
    NSLog([@"Fetching from URL " stringByAppendingString: [myStationURL absoluteString]]);
    NSData * foo = [myStationURL resourceDataUsingCache: NO];
    if (nil == foo) {
        NSString * reasonPrefix = @"Error retrieving current observations from '";
        NSString * reasonSuffix = @"'.";
        NSString * reasonMsg = [reasonPrefix stringByAppendingString:
                                    [[myStationURL absoluteString]
                                        stringByAppendingString: reasonSuffix]];
        NSException * exception = [NSException exceptionWithName:@"NWSStationFetchException" 
            reason:reasonMsg userInfo: nil];
        @throw exception;
    }
    NSLog(@"Got data");

    


and the result of running the unit test via Build of my UnitTest target:

    /bin/sh -c /Users/smb/Developer/Projects/NWSCurrentObs/build/NWSCurrentObs.build/Debug/UnitTest.build/Script-97276FE70E088C8800F0E701.sh
2008-06-18 18:15:30.945 NWSCurrentObs[5105] +[NSATSGlyphGenerator initialize] invocation.  The class is deprecated.
Test Suite 'All tests' started at 2008-06-18 18:15:30 -0400
Test Suite '/Users/smb/Developer/Projects/NWSCurrentObs/build/Debug/UnitTest.octest(Tests)' started at 2008-06-18 18:15:30 -0400
Test Suite 'ORRNWSCurrentObsUnitTest' started at 2008-06-18 18:15:30 -0400
2008-06-18 18:15:30.984 NWSCurrentObs[5105] Fetching from URL http://www.weather.gov/data/current_obs/KBED.xml

I had to click the "Stop Build" button to get the test un-hung.


Here's the result of Debug->Run Executable:

[Session started at 2008-06-18 18:39:51 -0400.]
2008-06-18 18:39:51.820 NWSCurrentObs[5147] Hello, World!
2008-06-18 18:39:51.825 NWSCurrentObs[5147] Fetching from URL http://www.weather.gov/data/current_obs/KBED.xml
2008-06-18 18:39:52.678 NWSCurrentObs[5147] Got data
2008-06-18 18:39:52.709 NWSCurrentObs[5147] Created parser
2008-06-18 18:39:52.709 NWSCurrentObs[5147] Parsed XML

NWSCurrentObs has exited with status 0.



There's nothing in the console or system logs.

Any ideas on what's going on and how to work around it?

Best regards,
-Steve

-- 

Steve Byan <email@hidden>

Littleton, MA 01460



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSURL resourceDataUsingCache: method hangs only during unit-test - 2.4
      • From: "Shawn Erickson" <email@hidden>
  • Prev by Date: Re: Adding dylib auses problems...
  • Next by Date: Re: Adding dylib auses problems...
  • Previous by thread: Re: Batch NIB->XIB
  • Next by thread: Re: NSURL resourceDataUsingCache: method hangs only during unit-test - 2.4
  • Index(es):
    • Date
    • Thread