如果iPhone中没有启用gps,我必须从我的应用程序打开设置应用程序.我使用了以下代码.它在iOS模拟器中运行良好,但在iPhone中不起作用.我可以知道此代码中是否有任何问题.
if (![CLLocationManager locationServicesEnabled]) {
int (*openApp)(CFStringRef, Boolean);
void *hndl = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices");
openApp = (int(*)(CFStringRef, Boolean)) dlsym(hndl, "SBSLaunchApplicationWithIdentifier");
openApp(CFSTR("com.apple.Preferences"), FALSE);
dlclose(hndl);
}
Run Code Online (Sandbox Code Playgroud) **My Web service class**
import javax.jws.WebMethod;
import javax.jws.WebService;
/**
* @author edward
*
*/
@WebService
public class HelloWeb {
@WebMethod
public String sayGreeting(String name) {
return "Greeting " + name + "....!";
}
}
Run Code Online (Sandbox Code Playgroud)
我的服务器java类
import javax.xml.ws.Endpoint;
public class Server {
public static void main(String[] args) {
Endpoint.publish("http://localhost:9090/HelloWeb", new HelloWeb());
System.out.println("Hello Web service is ready");
}
}
Run Code Online (Sandbox Code Playgroud)
服务器正常运行,我能够使用返回WSDL代码的url访问服务.但我想使用java中的唯一URL访问服务器.我有以下客户端Java代码.
客户端访问HelloWeb服务
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;
public class WebClient {
String wsdl = "http://172.21.1.65:9090/HelloWeb?wsdl";
String namespace = "http://helloweb.com";
String …Run Code Online (Sandbox Code Playgroud)