【发布时间】:2015-05-13 07:48:03
【问题描述】:
在 JavaScript 中使用 JSON.parse(parameter-value) 时,适配器调用工作正常,但是在本机 iOS 应用程序中执行类似操作时,它会失败并出现以下错误。
Javascript 适配器调用:
var invocationData = {
adapter : 'TEST_ADAP',
procedure : 'PROC1',
parameters : [JSON.parse(A)],
};
本地调用:
json= // some json value will be come
MyConnect *connectListener = [[MyConnect alloc] initWithController:self];
[[WLClient sharedInstance] wlConnectWithDelegate:connectListener];
WLProcedureInvocationData *myInvocationData = [[WLProcedureInvocationData alloc] initWithAdapterName:@"TEST" procedureName:@"test"];
myInvocationData.parameters = [NSArray arrayWithObjects:json, nil];
for (NSString *str in myInvocationData.parameters) {
NSLog(@"values of account test %@",str);
}
PasswardPage *invokeListener = [[PasswardPage alloc] initWithController:self];
[[WLClient sharedInstance] invokeProcedure:myInvocationData withDelegate:invokeListener];
【问题讨论】:
-
错误在哪里?还要提到本机部分中的“json”到底是什么。提供一个实际的例子。
-
我得到了这种格式的 json {test = 21321312}, {test=231312},我怎样才能改变正常格式?
-
我不懂你。提供错误。提供完整代码。
-
我需要这种格式 {test : 12345},{test2 : 232323}
-
你需要发送一个字符串数组。参数是一个字符串数组:www-01.ibm.com/support/knowledgecenter/SSHS8R_7.0.0/…
标签: ios objective-c ibm-mobilefirst worklight-adapters