Reloading / unloading the iOS-embedded OF app

Hello, I am trying to load data to OF app embedded in UIViewController

So I can load the app, pass data to it like this:

In OF app I have :

class CircleApp : public ofxiOSApp {


	public:

     CircleApp (NSString* logString);
    ~CircleApp ();
    
    void loadLog (NSString* logString);
    NSString* logFile;

	}


void CircleApp::loadLog (NSString* logString) {
    
    logFile = logString;
    NSString * file = [[NSBundle mainBundle] pathForResource:logFile ofType:@"csv"];
    
    csv.loadFile([file UTF8String]);

}

//--------------------------------------------------------------
CircleApp :: CircleApp (NSString* logString) {

    logFile = logString;
    
    cout << "creating CircleApp" << endl;
}

//--------------------------------------------------------------
CircleApp :: ~CircleApp () {
    cout << "destroying CircleApp" << endl;
}




//  then in My ViewController:
- (void)viewDidLoad
{
NSString *newLogFile = [Utils getCurrentLog];
circleApp = new CircleApp(newLogFile);
}

- (void) viewWillDisappear:(BOOL)animated{
 
// I assume something like this?    
    circleApp->exit();
    
}


- (void) viewWillAppear:(BOOL)animated{
	
	/* tried this for example, get notifications from OF app that the log is loaded, but it is not reflected in the draw
	NSString *newLogFile = [Utils getCurrentLog];
	circleApp->loadLog(newLogFile);

	*/
}

Question - what should I put into the viewWillDisappear: in the viewController so that I can unload the app and then reload it with newLog?

Typically, if you created the instance using new, use delete to destroy it. This will remove it from memory.

In your example, though, maybe you don’t need to create & destroy the circleApp instance every time. Maybe just loading in a new log file each time (and overwriting the old log data) would suffice…