6

I am gettings insane, I can't figure it out.

I have downloaded and tries to build XMLRPC for iOS. I triend with https://github.com/eczarny/xmlrpc and https://bitbucket.org/kdbdallas/xmlrpc-ios/wiki/Home The first one, the original one, doesn't have an iOS target. the second one should have, but even that one doesn't seem to work.

I build XMLRPC-iOS lib using XCode the following way:

  • download, unzip, open in xcode
  • Go to menu Product > Archive
  • In organized I choose "Share" on the latest build
  • I save it in my own project folder. Include it in the project.

When I build my own project I get:

ld: warning: ignoring file /Users/paulp/Documents/ios/iPhone/ios-account/Account/external/XMLRPC/libXMLRPC_iOS.a, file was built for archive which is not the architecture being linked (i386) Undefined symbols for architecture i386:
"_OBJC_CLASS_$_XMLRPCRequest", referenced from: objc-class-ref in MyAPI.o
"_OBJC_CLASS_$_XMLRPCConnectionManager", referenced from: objc-class-ref in MyAPI.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

How is that possible? The XMLRPC-iOS settings are set to:

  • SDKROOT = iphoneos5.0
  • ARCHS = $(ARCHS_STANDARD_32_BIT) = armv7
  • IPHONEOS_DEPLOYMENT_TARGET = 5.0
  • VALID_ARCHS = armv6 armv7k armv7f armv7
  • OTHER_CODE_SIGN_FLAGS = armv7k armv7f armv6 armv7
  • GCC_VERSION = com.apple.compilers.llvmgcc42

Can someone explain for me how I can build and use the XMLRPC-iOS library in my own application? Thanks!

Paul Peelen
  • 10,073
  • 15
  • 85
  • 168

3 Answers3

10

it worked for me; here is exactly what i did.

  • Create new project (called RpcTest)
  • Download the forked project from bitbucket, extracted the zip in my RpcTest directory, so my directory looks like this:

directory structure

  • Drag the XMLRPC-iOS.xcodeproj into my Xcode project (under Frameworks group, but this doesn't matter)
  • Now, to the build settings. Add kdbdallas-xmlrpc-ios-f28a13cc16ae under User Header Search Paths (uncheck recursive) in your project's Build Settings; now build your project (cmd+B)
  • go to Build Phases tab, expand Target Dependencies, add XMLRPC-IOS project, expand Link Binary With Libraries, add libXMLRPC_iOS.a. enter image description here

Now you should be able to include any xmlrpc header and use the lib.

Hope that helps.

EDIT Download via Dropbox. be advised: incomplete implementation, just a demo that xmlrpc works! ;)

mja
  • 5,056
  • 1
  • 29
  • 40
  • Awesome, really good explenation. I'll sure give it a try. Could you please send it to me? Paul -at- Paul Peelen -dot- com. Thanks! – Paul Peelen Sep 21 '11 at 09:26
  • Sure i can. I will upload it somewhere and post the link in the original answer, it just help other having the same issue. – mja Sep 21 '11 at 09:29
  • @mja thanks for posting the answer and code. It really helps. I just want to ask that https://github.com/eczarny/xmlrpc project have three targets. Can you please help how you have extracted the ios version(target) separately. – Gypsa Nov 20 '13 at 09:08
0

I've used the first one you mention https://github.com/eczarny/xmlrpc with success in an iPhone project.
Should be working. (was some time ago)

[EDIT]
Some more details : I imported XMLRPCResponse and XMLRPCEventBasedParser (+ all related classes to get them working from the project).

Then, here's the code to parse a response (I was doing the request by hand):

NSURL* url = [NSURL URLWithString:@"http://www.xxxxxxxxx.fr/xmlrpc.php"];
NSMutableURLRequest* urlRequest = [NSMutableURLRequest requestWithURL:url];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest addValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
NSString* param = [NSString stringWithFormat: @"<param><value><double>%f</double></value></param><param><value><double>%f</double></value></param><param><value><double>%.0f</double></value></param><param><value><int>1</int></value></param>",
                   request.coordinate.latitude,
                   request.coordinate.longitude,
                   request.radius/1000.0];
NSString* xmlrpcReq = [NSString stringWithFormat:@"<?xml version=\"1.0\"?><methodCall><methodName>geoSearch</methodName><params>%@</params></methodCall>", param];
[urlRequest setHTTPBody:[xmlrpcReq dataUsingEncoding:NSUTF8StringEncoding]];
NSURLResponse* response;
NSError* error;
NSData* content = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error];
XMLRPCResponse* rpcResponse = [[XMLRPCResponse alloc] initWithData:content];
if ([rpcResponse faultCode]==0) { 
     NSArray* result = (NSArray*)[rpcResponse object];

Cheers Lionel.

yonel
  • 7,855
  • 2
  • 44
  • 51
  • Thanks for you answer lionel, however sadly enough it didnt help me at all. Would be awesome if you could explain how you got it to work for your project. – Paul Peelen Sep 15 '11 at 13:38
  • I checked at my old project and here's what I could extract ;) – yonel Sep 16 '11 at 08:37
0

May i know what target you are setting ? for example three target available, if you using for iOS, please select libXMLRPC then build then select the libXMLRPC.a files from the build and then link it to our project. then it will run.

maheswaran
  • 417
  • 3
  • 11