How to use NSLog with data from a server [duplicate] - objective-c

This question already has answers here:
ios programming - Data argument not used by format string
(2 answers)
Closed 6 years ago.
Hi there I'm trying to do an NSLog but what I want to see is what it's inside of my dictionary like this.
NSLog(#"diccionario", diccionario);
And this warning appears:
Data argument not used by format string
The diccionario object contains data from a server so like I said I want to print in the console the info that diccionario contains, because is not printing anything.
Thanks.

NSLog(#"diccionario : %#", diccionario);
Should be the solution.

Related

How to compare downloaded file in karate? [duplicate]

This question already has answers here:
How to get the downloaded xlsx file from the api endpoint in karate?
(2 answers)
Closed 1 year ago.
I would like to compare the text file, however the API is returning application/octet-stream which I cannot change currently. That's why karate probably tries to compare the binary and test. That means this:
Given path '/download/testing/'+fileId
When method get
Then status 200
And match response == read('../files/test.txt')
leads to:
match failed: EQUALS
$ | data types don't match (LIST:STRING)
[116,101,115,116,105,110,103]
'testing'
The file test.txt contains just testing. I cannot find the way how to convert string to byte array. I could use probably java function, but at first I would like to find out if there is some built-in function.
You can do type conversions: https://github.com/karatelabs/karate#type-conversion
So this will convert a binary response into text:
* string response = response
That should get you going. The reverse is also possible.
For completeness, note that the responseBytes variable will always contain a copy of the response, but as a byte-array.

Why is Postman giving the error “TypeError: e.exec is not a function” [duplicate]

This question already has an answer here:
Javascript regexObj.exec() says TypeError: pattern.exec is not a function
(1 answer)
Closed 2 years ago.
I am trying to check if a string exists with
pm.expect(jsonData[0]["name"]).to.match('abagnale');
but I am getting
TypeError: e.exec is not a function
Use a regex expression instead of a string
The error message is a little generic but in this case it can be fixed by using a regex
to.match(/abagnale/)
instead of a string
to.match('abagnale')

Fortran: Variable initialization wwith parenthesis [duplicate]

This question already has answers here:
Array declaration in FORTRAN for beginners
(2 answers)
Closed 6 years ago.
I am trying to understand a Fortran90 code. In the code, I found this expression for initializing a variable:
integer :: time(8)
What is meant by this? What does the parenthesis do?
That syntax declares an INTEGER rank one array of size eight.
(In Fortran terminology that source does not initialize anything and it is a declaration, not an expression.)

Add text to label(not changing) in Xcode [duplicate]

This question already has answers here:
Shortcuts in Objective-C to concatenate NSStrings
(30 answers)
Closed 8 years ago.
Is it possible to add on to the text of a label without changing existing text? I'm new to mac development in Xcode so any help is appreciated.
Yes and no. Basically, you replace the text with a new string that includes the old text
self.myLabel.text = [self.myLabel.text stringByAppendingString:#"more stuff"];

How can I compare a string variable to a string in xcode? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
String comparison in Objective-C
I realize that the question is not very specific. I am working on a simple trivia game to test a couple of things, right now it has 5 arrays, one for the questions, one for the first answer option, one for the second answer option, one for the third, and one that says which one is correct.
I have an if statement in that checks wether the button pressed matches the correct answer.
Answer2 is connected to the button that would select option b in my trivia app, strCorrect is the string array that holds the single character that says which option out of the three is right, intCurrentQuestion is just an integer I use to reference the index of the arrays.
-(IBAction)Answer2{
if ([strCorrect objectAtIndex:intCurrentQuestion] == [NSString stringWithFormat:#"B"]){
//do these things blah blah
}
}
The problem is that there are no errors when it is compiled but it doesn't work either. How do I go about making this work?
For testing purpose I am cheating and passing the strCorrect to a hidden label in the nib and then comparing the label text to #"B" and it works but its...well its just awful.
What you're doing in your code above is comparing the memory address of two strings, not their value. Do compare two NSStrings you have to do this:
[[strCorrect objectAtIndex:intCurrentQuestion] isEqualToString:#"B"];
[[strCorrect objectAtIndex:intCurrentQuestion] isEqualToString:#"B"]