You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to get Gson through j2objc such that I can use it for my iOS swift framework. I am using J2ObjC 2.8 and GSON 2.8.5. and all the classes are translating correctly. However, while running the tests, I cannot successfully convert the data using GSON as the function throws the error.
Java Code
public class Request {
private String name;
private String description;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}
public class AService {
public String getGsonString(Request request) {
Gson gson = new Gson();
return gson.toJson(request);
}
}
I am using the converted code of the above code to run the test case in the swift project
func testGsonString(){
let request = ComRequest()
request?.setNameWith("name")
request?.setDescriptionWith("description")
let response = ComAService().getGsonString(with: request!)
XCTAssertNotNil(response)
}
While running the above code, The ComAService().getGsonString(with: request!) throws error
I have used j2objc-maven-plugin 1.1.4 for conversion and gson 2.8.5.
I require gson to convert string to object or object to a string so that I can use the converted string to store in the local database and vice versa
I am trying to get Gson through j2objc such that I can use it for my iOS swift framework. I am using J2ObjC 2.8 and GSON 2.8.5. and all the classes are translating correctly. However, while running the tests, I cannot successfully convert the data using GSON as the function throws the error.
Java Code
I am using the converted code of the above code to run the test case in the swift project
While running the above code, The ComAService().getGsonString(with: request!) throws error
I have used j2objc-maven-plugin 1.1.4 for conversion and gson 2.8.5.
I require gson to convert string to object or object to a string so that I can use the converted string to store in the local database and vice versa