XMLRPC-iOS for iOS project

安稳与你 提交于 2019-12-21 02:00:14

问题


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!


回答1:


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:

  • 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.

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! ;)




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/7362892/xmlrpc-ios-for-ios-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!