Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Armin1983

macrumors newbie
Original poster
Jan 29, 2012
11
0
Hello guys,

I am writing a Web scraper APP, First i implemented it and ran it through Console, It works great! but after i tried to make a GUI for that, It does not work.

Application class Called: ScraperApp
Class for GUI called: ScraperCocoaApp

the problem is with method!

Code:
-(IBAction) FieldAndXPathQuery:(id)sender

when i press SET button, it gives the EXC_BAD_ACESS error !

>> To observe the problem just fill the textboxes and press SET.

I appreciate anyone's help, if you just download the the attached project and take a look at that.

Thanks
 

Attachments

  • Screen shot 2012-02-10 at 6.09.28 PM.png
    Screen shot 2012-02-10 at 6.09.28 PM.png
    18 KB · Views: 118
  • CocoaScraper.zip
    151.7 KB · Views: 88
So what does the compiler tell you when do an "Analyze"?
Have you turned on all compiler warnings that make sense?
 
So what does the compiler tell you when do an "Analyze"?
Have you turned on all compiler warnings that make sense?

Thank you for reply,

I did do an analyze, it is successfully! the error happen when i press the "set" button!

How can i turn on compiler warning ? i am using xcode 3.2
 
Thank you for reply,

I did do an analyze, it is successfully! the error happen when i press the "set" button!

How can i turn on compiler warning ? i am using xcode 3.2

In your build settings, there are about two dozen warnings that you can turn on. Things like uninitialized variables and so on. But if you run your app from Xcode, it will stop in the debugger when that error happens, and you can look at the variables at that time, which methods were called, and so on.

The very first thing that you should do is to set a breakpoint on the first statement of FieldAndXPathQuery, and then step go through the code step by step, looking at the contents of variables after each step, and finding out what doesn't work the way you think it should work.
 
In your build settings, there are about two dozen warnings that you can turn on. Things like uninitialized variables and so on. But if you run your app from Xcode, it will stop in the debugger when that error happens, and you can look at the variables at that time, which methods were called, and so on.

The very first thing that you should do is to set a breakpoint on the first statement of FieldAndXPathQuery, and then step go through the code step by step, looking at the contents of variables after each step, and finding out what doesn't work the way you think it should work.

Actually i used break point! i was not able to figure out the error. even i placed it insed a try/catch. it even does not give me the reason ... that is why i uploaded the project here, so if u professional guys can find the problem, since morning i have been working on this problem, but still no result :(
 
Actually i used break point! i was not able to figure out the error. even i placed it insed a try/catch. it even does not give me the reason ... that is why i uploaded the project here, so if u professional guys can find the problem, since morning i have been working on this problem, but still no result :(

Did it stop at the break point? Inside your method? What was the call stack? Or did it crash before reaching the break point? Which means your action method isn't called, so check your connection in interface builder.

try / catch isn't going to help at all. The only place where using try / catch is appropriate in Objective-C is when working with distributed objects, which you are not. Outside that area, any exception thrown is a bug in your application that needs to be fixed.
 
Thanks all guys,

Actually the problem was this.

in a class i initialized my NSDictionary object in this way -> [NSMutableDictionary dictionary]

in that class its fine, but i inherited that class for another class. so since it became super class it could not work with that kind of initialization!

Thanks to all.
 
i inherited that class for another class. so since it became super class it could not work with that kind of initialization!

You weren't trying to subclass NSDictionary were you? That's not a good idea. The better approach is to use composition to extend the functionality of a custom NSObject that adds the required functionality to a standard NSDictionary.

It looks like you're improving at debugging your own problems and writing better questions.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.