• 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
Really strange things happening!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Really strange things happening!


  • Subject: Really strange things happening!
  • From: Marco Michieli <email@hidden>
  • Date: Sat, 14 Feb 2004 14:35:19 +0100

I need some help! There are two really strange things happening in my
code!

MyApplication (MyApp) has a WebController that creates an object
(MyConnection) that has a method that knows how to recursively create
an asynchronous connection that loads a page (Step 1), get some info
and read the next url to load and call itself again (Step 2) until all
the pages have been loaded; then returns all the info to the
WebController (Default step) and releases itself.

It seems to work just fine:

2004-02-14 01:34:17.481 MyApp[770] Initializing <MyConnection:
0x11ba3d0>
2004-02-14 01:34:17.481 MyApp[770] Step 1
2004-02-14 01:34:21.537 MyApp[770] Succeeded! Received 13733 bytes of
data
2004-02-14 01:34:21.538 MyApp[770] Step 2
2004-02-14 01:34:21.548 MyApp[770] NextUrl found: reapeat Step 2
2004-02-14 01:34:24.855 MyApp[770] Succeeded! Received 13782 bytes of
data
2004-02-14 01:34:24.856 MyApp[770] Step 2
2004-02-14 01:34:24.866 MyApp[770] NextUrl found: reapeat Step 2
2004-02-14 01:34:28.189 MyApp[770] Succeeded! Received 13824 bytes of
data
2004-02-14 01:34:28.189 MyApp[770] Step 2
2004-02-14 01:34:28.199 MyApp[770] NextUrl found: reapeat Step 2
2004-02-14 01:34:30.881 MyApp[770] Succeeded! Received 10823 bytes of
data
2004-02-14 01:34:30.882 MyApp[770] Step 2
2004-02-14 01:34:30.889 MyApp[770] No NextUrl: go to Default step
2004-02-14 01:34:30.889 MyApp[770] Default step
2004-02-14 01:34:30.889 MyApp[770] Return Info to webController
2004-02-14 01:34:30.889 MyApp[770] MyConnection retainCount:1
2004-02-14 01:34:30.890 MyApp[770] Destroying <MyConnection: 0x11ba3d0>

-----------------------------------
FIRST STRAGE THING:
-----------------------------------

If I remove the following line (that is supposed to print just a
message to the console as long as I know):

NSLog(@"Succeeded! Received %d bytes of data", [myData length]);

from the method:

- (void)connectionDidFinishLoading:(NSURLConnection *)connection

I got the following error:

2004-02-14 13:08:48.939 MyApp[406] Initializing <MyConnection:
0x11a7860>
2004-02-14 13:08:48.939 MyApp[406] Step 1
2004-02-14 13:08:53.773 MyApp[406] Step 2
2004-02-14 13:08:53.783 MyApp[406] NextUrl found: reapeat Step 2
2004-02-14 13:08:53.783 MyApp[406] *** -[NSCFString keyEnumerator]:
selector not recognized
2004-02-14 13:08:53.784 MyApp[406] *** -[NSCFString keyEnumerator]:
selector not recognized

Why? NSLog should just print a message to the console, and [myData
length] should just access an int value. Right?
In my code I never call [NSCFString keyEnumerator]. How can NSLog
affect the behavior of MyApp?

-----------------------------------
SECOND STRAGE THING:
-----------------------------------

MyConnection actually does not return any info to the WebController: in
fact it's not possible to call any method in the Default Step, not even
a method that just print a message to the console: the application
crashes!
See below the code that does all the work in MyConnection (some part of
the code have been omitted):

- (void)getInfo
{
switch ([self step]) {
case 1:
NSLog(@"Step 1");
// Some code here to load a page and parse html
// to get some info and the next url (Step 2)
break;
case 2:
NSLog(@"Step 2");
// Some code here to load the next url, parse html
// to get some info and the next url (Step 2)
// if there's no next url return all info (Default step)
break;
default:
NSLog(@"Default step");
NSLog(@"Return Info to webController");
//IF I REMOVE "//" IN THE NEXT LINE THA APPLICATION CRASHES!!!
//[self returnInfoToWebController];
// Release self
[self release];
break;
}
}

- (void)returnInfoToWebController
{
NSLog(@"Return Info to webController");
}

If I run MyApp as it is it works fine, but actually it does not return
any info to WebController because the method
(void)returnInfoToWebController never get called because there is the
"//".
If I remove the "//" where indicated the application crashes as follows:

2004-02-14 01:37:35.854 MyApp[791] Initializing <MyConnection:
0x108ab50>
2004-02-14 01:37:35.854 MyApp[791] Step 1
2004-02-14 01:37:39.617 MyApp[791] Succeeded! Received 13733 bytes of
data
2004-02-14 01:37:39.617 MyApp[791] Step 2
2004-02-14 01:37:39.627 MyApp[791] NextUrl found: reapeat Step 2

MyApp has exited due to signal 11 (SIGSEGV).

That's really strange because Step 2 has not been changed and the
Default step (that is supposed to call the method that returns the
info) should not have been reached! Any idea?

Note that:
- the method (void)returnInfoToWebController is exactly as it's written
above, that is now is supposed just to print a message to the console
(in the future should actually return the info);
- I don't get any warning while compiling the application, so there
should not be any mistyping .

Any opinion/suggestion would be greatly appreciated!

Thanks

Marco
_______________________________________________
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: Incapsulating the Bundle resources in a ".ja" file
  • Next by Date: Re: Drag&Drop with draw rectangle as iTunes
  • Previous by thread: Re: Does NSControl "remember" cells
  • Next by thread: Problem Compiling Cocoa App
  • Index(es):
    • Date
    • Thread