I am using quickdialog to consume dynamic forms.
A webservice builds up a form with the quickdialog JSON.
For a QDateTimeInlineElement he provides me this JSON.
{"type":"QDateTimeInlineElement","title":"datum","placeholder":"vul in","bind":"textValue:datum","key":"datum","mode":"Date"},
{"type":"QDateTimeInlineElement","title":"tijd","placeholder":"vul in","bind":"textValue:tijd","key":"tijd","mode":"Time"},
{"type":"QDateTimeInlineElement","title":"datumtijd","placeholder":"vul in","bind":"textValue:datumtijd","key":"datumtijd","mode":"DateAndTime"},
In my code I put all the values in a dictionary using the following piece of code.
NSMutableDictionary *script = [NSMutableDictionary new];
[self.root fetchValueUsingBindingsIntoObject:script];
But when I look at an output of this dictionary I notice the following LOG
Date = "00:00:-34";
DateTime = "00:00:-34";
TIME = "00:00:-34";
Can anybody help me with this? Kind regards !
Related
In my app Web services are created in dot net and i am consuming those and I am getting response.In that all the fields like company,type,location everything are strings and there is no problem with this..And there is one more field called Exhibit number actually it is a Integer but they are created as string only.While I am displaying this it is showing zero instead of that number.. Here is my code...
//Storing into Array
[SurveyFilesArray addObject:[NSDictionary dictionaryWithObjectsAndKeys:[dic objectForKey:#"FileName"],#"FileName",[dic objectForKey:#"ExibhitNumber"],#"ExhibitNumber",[dic objectForKey:#"Description"],#"Description",[dic objectForKey:#"FileQuality"],#"FileQuality",nil]];
//Retrieving from Array..
NSLog(#"???%#???",[NSString stringWithFormat:#"%d",[[[SurveyFilesArray objectAtIndex:indexPath.row]objectForKey:#"ExibhitNumber"]intValue]]);
NSLog(#"%d",[[[SurveyFilesArray objectAtIndex:indexPath.row]objectForKey:#"ExibhitNumber"]intValue]);
You have typos in your code.
In the order of your code:
Ex-ib-hit-Number
Ex-hib-it-Number
These are 2 different strings.
In your example code you save it correctly written as Ex-hib-it. But you try to access it with ex-ib-hit afterwards. This cannot work.
I've combed the questions on here hoping to find a similar situation that I am in, but couldn't find one. My question deals with the NSJSONSerialization class in iOS 5, and how to handle parsing a single value returned from the JSONObjectWithData:options:error: method. The JSON data returned is a single value in an array that looks like this:
[1]
The data will either be 1 (as seen above) or 0, depending on the logic being done in the web service I'm using. As a side note, the web service is a WCF REST service. In XCode, the debugger displays the following after the deserialized JSON is assigned to a temporary NSArray object:
po parsedData
(NSArray *) $43 = 0x06e2ee70 <__NSCFArray 0x6e2ee70>( 1 )
When I try to get the value from the array using ObjectAtIndex:, I get this:
po [parsedData objectAtIndex:0]
(id) $44 = 0x06b1dad0 1
My question is: what is the hex value (0x06b1dad0) before the 1? Maybe a key or index that I am not accessing (I was thinking that I just didn't go far enough into the array to get the real value)? Does it have something to do with how the JSON is formatted? As I've been thinking about it, I have a feeling that the formatting is off.
The problem I am having is that I cannot get the actual value that is stored in the JSON message--when I access the element in the array parsedData and assign it to a variable, it is returning just the hex value and not 1.
Casting to NSInteger gives this:
po (NSInteger)[parsedData objectAtIndex:0]
(NSInteger) $45 = 112319184 1
Any insight into this would be greatly appreciated. I apologize if this has been addressed elsewhere in the forum.
Thanks.
Its likely that the object is an NSNumber try this:
[[parsedData objectAtIndex:0] intValue];
(I am a newbie on Objective-C, and) I have been trying to pass a pdf name and initialize a class like this:
contCon = [[contentController alloc] initwithPdf:#"mag.pdf"];
and
-(id)initwithPdf:(NSString *)pdfName{ ... }
it gave me no error but pdf name doesn't come up as I sent it. So i tried to do this:
contCon = [[contentController alloc] initwithPdf:CFSTR("mag.pdf")];
I also couldn't figure ou how to get this type of data in the method.
-(id)initwithPdf:(CFSTR)pdfName
or
-(id)initwithPdf:(CFSTR *)pdfName
doesn't seem to work, and google didn't help me either.
I want to know in what type to pass the name of the pdf file. Thanks in advance.
contCon = [[contentController alloc] initwithPdf:#"mag.pdf"];
and
-(id)initwithPdf:(NSString *)pdfName{ ... }
is better one......
Your first method is the right one. And what does "it doesn't come up" mean?
Why don't you pass the whole filepath of the pdf,rather than just the pdfName??
Define : "pdf name doesn't come up as I sent it"
I'm trying to consume an ASP.net Web service, and found a utility called WSDL2ObjC.
Now I'm trying to use it, and basic use is working (asking for simple data types, such as booleans or strings), but now I'm requesting an array of the "EmailServiceSvc_Email" structure, which contains "subject", "from" and "message" properties.
The app won't compile, with the message above, and here's the code on wich it gets stuck:
EmailServiceSvc_Email * eml = (EmailServiceSvc_Email *) arrEmails[[indexPath row]];
This is the explanation of the variables:
eml : the new variable I'm trying to get out of arrEmails.
arrEmails: an NSMutableArray of the EmailServiceSvc_Email object
indexPath: the indexPath parameter, this is from the cellForRowAtIndexPath function.
As you can see probably, I want to display all the "subject"s from the "EmailServiceSvc_Email" structure in a TableView, on the iPhone.
To get an element out of an NSMutableArray you must use -objectAtIndex:. The a[i] syntax does not work with NSArrays.
EmailServiceSvc_Email* eml = [arrEmails objectAtIndex:indexPath.row];
I wrote a tutorial about Wsdl2objc and complex types:
http://brismith66.blogspot.com/2010/07/iphone-development-accessing-soap.html
I'm not sure about parsing an xml with attributes. have seen a similar question here
But it shows to get an attribute of intValue. But i need to get the attributes of string type,How to do that?? Images of xml and the relevant portions are given in the following links
Click here for xml and here for required data
This answer to the linked question should work for you as well. The contents of attributeDict are already NStrings. All that is going on extra in the linked answer that they are calling the intValue method on the returned NSString to parse that string into an int. In your case, you don't need this little bit of an extra step. If you just do this:
NSString * stringValue = [attributeDict objectForKey:#"attribute"];
you'll have the value of the attribute called "attribute" in a string.