ios - getting BAD_ACCESS Error Calling C++ from Objective-C++. All files are .mm but still this issue -


I know that a lot has been said and I have made it here by seeing it here and there.

I have all the Objective-C files .mm. is as.

In addition, I can see in the output console that "this = (a *) NULL" is used to call the object b (int x) function is zero.

This is my position, I'm starting a c ++ class from the objective c ++ (.mm) class. But I'm getting BAD_ACCESS

"a.cpp"

  #include "a.h" zero: :: b (int x) {cout < & Lt; "Hi"; C.push_back (x); // EXC_BAD_ACCESS error is here & lt; & Lt; c.size (); }   

Other files are as follows.

"a.h"

  #ifndef __Cigiments__File__ #define __Cperiments__File__ #include & lt; Iostream & gt; #include & lt; Vector & gt; using namespace std; Class A {Public: Vector & lt; Int & gt; C; Zero (int x) b; }; #endif / * Defined (__Cperiments__File__) * /   

AppDelegate.h #import & lt; UIKit / UIKit.h & gt; #import "ViewController.h" @ Interface AppDelegate: UIResponder & lt; UIApplicationDelegate & gt; @protecti (strong, non-fixed) UIWindow * window; @ Property (strong, non-fixed) ViewController * viewController; AppendectiveWithOptions: (AppDelegate.mm) "AppDelegate.h" @ Implementation AppDelegate - (BOOL) Application: (UIApplication *) Application FinishLaunchingWithOptions: @end

AppDelegate.mm

 (NSDictionary *) Launch option {self.window = [[UIWindow alloc] initWithFrame: [[UIScreen main screen] border]]; Self.viewController = [[ViewController alloc] initWithNibName: zero bundle: zero]; Self.window.rootViewController = self.viewController; [Self. Windows and knowledgeable]; Yes come back } @end   

ViewController.h

  #import & lt; UIKit / UIKit.h & gt; #import "a.h" @ View Interface Controller: UIViewController {a * objA; } - (id) init; @protecti (read only, assign) * obja; @end   

ViewController.mm

  #import "ViewController.h" @ Interface View Controller () @end @implementation ViewController - (id) init {if ((Self = [super init])) {objA = new A (); } Healthy return; } - (zero) viewDidoadload [[Super Viewedload]; ObjA- & gt; B (5); } @end   

Whatever else I remember, I can put some entries in vector.

Thank you

As stated in the comments by @Bourordan I have never Not called in APIDEEGet.m.

This line changed to appdelegate.mm

  self.viewController = [[ViewController alloc] initWithNibName: zero bundle: zero];   

with

  self.viewController = [[ViewController alloc] init];   

Thanks for the quick help.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -