-1

I´m really stuck with this issue... and i hope you can help me out here.

I'm developing an iPad app for a company, that requires to use secured SOAP web services... not the perfect combination! i know, the thing is that taking a look around google, i found that the "best" thing to do was making a WS client using gSOAP and that´s what i did! now i have the client for one of those WS in C++.

When i try to call one of the methods of the WS, and build the app... this is what happens:

Ld /Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Products/Debug-iphonesimulator/App.app/App normal i386
cd /Users/me/iOS/App

setenv MACOSX_DEPLOYMENT_TARGET 10.6

setenv PATH '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin'

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk 
-L/Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Products/Debug-iphonesimulator 
-L/Users/me/iOS/App -F/Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Products/Debug-iphonesimulator 
-F/Applications/Xcode.app/Contents/Developer/Library/Frameworks 
-filelist /Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/App.LinkFileList 
-mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 
-framework SenTestingKit -framework Foundation -framework UIKit -framework QuartzCore -framework CoreGraphics -ldataSOAPlibDev 
-o /Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Products/Debug-iphonesimulator/App.app/App

ld: warning: ignoring file /Users/me/iOS/App/libdataSOAPlibDev.a, 

file was built for archive which is not the architecture being linked (i386)

Undefined symbols for architecture i386:

    'soap::soap()', referenced from:
  -[ViewContratosController viewDidLoad] in ViewContratosController.o
  '_soap_init_LIBRARY_VERSION_REQUIRED_20808', referenced from:
  -[ViewContratosController viewDidLoad] in ViewContratosController.o
 'soap_call_ns1__obtenerPais(soap*, char const*, char const*, ns2__paisFile*,     
  ns1__obtenerPaisResponse&)', referenced from:
  -[ViewContratosController viewDidLoad] in ViewContratosController.o
 'soap::~soap()', referenced from:
  -[ViewContratosController viewDidLoad] in ViewContratosController.o
 'ns2__paisFile::soap_default(soap*)', referenced from:
  ns2__paisFile::ns2__paisFile() in ViewContratosController.o
 'vtable for ns2__paisFile', referenced from:
  ns2__paisFile::ns2__paisFile() in ViewContratosController.o

NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

The NOTE may tell the problem... but i don´t know how to solve it... any ideas?

Thanks!

VaroX
  • 430
  • 4
  • 17

2 Answers2

0

The problem is probably that you took a library for iPAd (ARM architecture) and tried to build to the simulator (i386 architecture). Try building to the actual device instead.

The hint for me was:

ld: warning: ignoring file /Users/me/iOS/App/libdataSOAPlibDev.a, file was built for archive which is not the architecture being linked (i386)

MByD
  • 135,866
  • 28
  • 264
  • 277
  • First of all, thanks for the quick answer! i´ve been working on building the libdataSOAPlibDev.a library in the same architecture of the main project, but the problem didn´t dissapear! The good thing is that i realized that i was missing some cpp files in the "Compile Sources" for the Target of the Static Library (libdataSOAPlibDev.a)... i have to say, that this library contains the files generated by gSOAP (.h, .cpp, and .xml). Now the issue is that i have a new error: this time is: ld: duplicate symbol soap_instantiate_std__string... this is duplicated... but built by gSOAP! :(( – VaroX Apr 12 '12 at 13:31
-1

OK! i solved it including (not importing) the headers and the nsmap generated by gSOAP in the .mm file where i´m trying to consume the WS...

#include "soapH.h"
#include "soapStub.h"
#include "soapdataServiceSoapBindingProxy.h"
#include "dataServiceSoapBinding.nsmap"

If you are going to make a static library out of a WS Client created by gSOAP, be REALLY careful with the "Build Phases" of the library Project... add carefully the headers and the compile sources!

After that... import to your iOS proyect the "lib.a" with the headers and the XMLs under the same folder! and call the WS doing something like this:

dataServiceSoapBinding service;
ns2__countryFile country;
struct ns1__getCountryResponse response;

country.idCountry = 11;

if(service.ns1__getCountry(&country, response) == SOAP_OK) {
    NSLog(@"ok");
} else {
    NSLog(@"ERROR");
}

I hope this may help anybody... because i had such a hard time figuring this out... and didn´t find much info about it!

:)

VaroX
  • 430
  • 4
  • 17