Trace Actionscript, Objective-C NSLog ()

, usata per il debug delle applicazioni. Taking up the post from Actionscript to Objective-C (where you compare the code and syntax ActionScript and Objective-C), we have the convenient feature in ActionScript trace ( ) , used for debugging applications. This function outputs a console on the Adobe Flash development environment. It is mainly used for debugging and testing of "movie" / application. In XCode / Objective-C we have: NSLog ( ) . di Actionscript: The syntax of this function is very similar to the trace ( ) in Actionscript:

1
"Sono una linea di debug" ) ; NSLog (@ "I am debugging a line");

In Actionscript we have:

1
"Sono una linea di debug" ) ; trace ("I am debugging a line");

Apart from the use of the sign (@), as you can see, are identical. The differences (and similarities) start when you want to display values ​​of variables, for example in Actionscript we have:

1
2
3
"Coordinata x:" + x + " coordinata y:" + y ) ; trace ("x-coordinate:" + x + "y coordinate:" + y);
/ / Or
"Coordinate: " , x , y ) ; trace ("Coordinates", x, y);

In Objective-C we have:

1
"Coordinata x:%i coordinata y:%i" , x, y ) ; NSLog (@ "x-coordinate: the y coordinate%% i", x, y);

che opera sull'Apple System Log. Note: NSLog() actually calls the more generic function NSLogv ( ) that operates on the implementa System Log. The functions are in fact identical, changing only the input parameters.

o sprintf ( ) . The developers will find very familiar with the C string formatting, as with printf ( ) or sprintf ( ) . For details, see String Format Specifiers .

There are no comments for this post

Leave a comment

XHTML TAG PERMIT: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre> // blocco generico <code></code> // blocco generico [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL