ofxGuiExample is not working in iOS

When I build the ofxGuiExample for iOS, I get the following error
How can I fix this?

Undefined symbol: ofxSlider::ofxSlider(ofParameter, float, float)

Undefined symbols for architecture arm64:
“ofxSlider::ofxSlider(ofParameter, float, float)”, referenced from:
std::__1::unique_ptr<ofxSlider, std::__1::default_delete<ofxSlider > > std::make_unique_helper<ofxSlider, ofParameter&, float&, float&>(std::__1::integral_constant<bool, false>, ofParameter&, float&, float&) in ofxGuiGroup.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The development environment is
Xcode 12.4
macOS Catalina 10.15.7
of_v0.11.2_ios_release

can you please post the code you are using?
Please do it inline rather than uploading files.
just paste the code in the text box, select it all and press the </> button that it is on the top of the textbox.

I used the following code.

void ofApp::setup(){	

    //ofSetOrientation(OF_ORIENTATION_90_LEFT); 
	ofSetVerticalSync(true);
	
	// we add this listener before setting up so the initial circle resolution is correct
	circleResolution.addListener(this, &ofApp::circleResolutionChanged);
	ringButton.addListener(this,&ofApp::ringButtonPressed);

	// change default sizes for ofxGui so it's usable in small/high density screens
	ofxGuiSetFont("Questrial-Regular.ttf",10,true,true);
	ofxGuiSetTextPadding(4);
	ofxGuiSetDefaultWidth(300);
	ofxGuiSetDefaultHeight(18);

	gui.setup("panel"); // most of the time you don't need a name but don't forget to call setup
	gui.add(filled.set("bFill", true));
	gui.add(radius.set( "radius", 140, 10, 300 ));
	gui.add(center.set("center",glm::vec2(ofGetWidth()*.5,ofGetHeight()*.75),glm::vec2(0,0),glm::vec2(ofGetWidth(),ofGetHeight())));
	gui.add(color.set("color",ofColor(100,100,140),ofColor(0,0),ofColor(255,255)));
	gui.add(circleResolution.set("circleRes", 5, 3, 90));
	gui.add(twoCircles.setup("twoCircles"));
	gui.add(ringButton.setup("ring"));
	gui.add(screenSize.set("screenSize", ofToString(ofGetWidth()) + "x" + ofToString(ofGetHeight())));
	
	bHide = true;

	ring.load("ring.wav");

    //screenSize = ofToString(w) + "x" + ofToString(h);
}

//--------------------------------------------------------------
void ofApp::circleResolutionChanged(int & circleResolution){
	ofSetCircleResolution(circleResolution);
}

//--------------------------------------------------------------
void ofApp::ringButtonPressed(){
	ring.play();
}

//--------------------------------------------------------------
void ofApp::update(){

}

//--------------------------------------------------------------
void ofApp::draw(){
    ofBackgroundGradient(ofColor::white, ofColor::gray);
    
	if( filled ){
		ofFill();
	}else{
		ofNoFill();
	}

	ofSetColor(color);
	if(twoCircles){
		ofDrawCircle(center->x-radius*.5, center->y, radius );
		ofDrawCircle(center->x+radius*.5, center->y, radius );
	}else{
		ofDrawCircle((glm::vec2)center, radius );
	}
	
	if( bHide ){
		gui.draw();
	}
}

//--------------------------------------------------------------
void ofApp::exit(){
	ringButton.removeListener(this,&ofApp::ringButtonPressed);
}

of_v0.11.2_ios_release>examples>ios>ofxGuiExample
I built this project without any changes.

I dont have your xcode version in order to check it.

did you update the example with project generator before trying to compile?
Open Project generator and just drag and drop into it the folder of the example.

On Xcode, on the left side panel, find and select ofxSlider.cpp. Then look in the right side panel, in the Target membership section if it is checked for your project. if not check it and recompile.

ok. so it has nothign to do with what I mentioned before. Apparently it is a bug, but easy to fix.
open ofxSlider.cpp scroll all the way to the bottom and comment out the line that reads //#ifdef TARGET_OSX and the line that reads //#endif

It should look like this

//#ifdef TARGET_OSX
template class ofxSlider<typename std::conditional<std::is_same<uint32_t, size_t>::value || std::is_same<uint64_t, size_t>::value, bool, size_t>::type>;
//#endif

do the same thing in ofxInputField.cpp, which you should leave looking like the following

//#ifdef TARGET_OSX
template class ofxInputField<typename std::conditional<std::is_same<uint32_t, size_t>::value || std::is_same<uint64_t, size_t>::value, bool, size_t>::type>;
//#endif

Last, follow the screenshot

Let me know if this works.
I will push a fix for this.

1 Like

It worked that way.
Thank you for your help!

1 Like

Thank you. I have been testing UIs for an app and can confirm that the error is gone and the project runs as expected.

EDIT: never mind the rest of the post, same issue here: Addon suggestion for input text field on iOS13

As I was testing it I noticed that the screenSize ofParameter behaves like a text input field but as it gains focus the iOS keyboard doesn’t show up. I added a text input field to confirm it, and the same occurs. I tried to add a listener as showed in How to enter text in ofxGui?. I haven’t finished yet - a bug crept in - but I think that the keyboard showing up should precede the listening event, no?

Thanks again.