DetailsIPhoneThe basic development skills of applications are the content to be introduced in this article. This article is suitable for mobile developers. Let's look at the details first.
1. view Objective-C code in Windows
An appropriate solution is to add the syntax definition of Objective-C in UltraEdit.
Reference http://www.cocoachina.com/bbs/read.php? Tid-1054.html
The syntax definition file is added. It is successfully used in UltraEdit 12.0.
Ii. virtual machinesMacOSCode editing
Using virtual machines to edit code is often very slow. Therefore, it is recommended that you edit the code on the HOST side, that is, WINDOWS. You can search for some code segments from the network and stick them to the code. Therefore, code editing on WINDOWS is faster and more convenient.
MacOSXYou can use FTP or Samba to share files in WINDOWS. The advantages of Samba are completely bidirectional. No encoding problem. However, the biggest problem with virtual machine cooperation is that the network of the virtual machine is broken from time to time. Once the network is broken, the software on the WINDOWS side is the same as that on the dead side. For example, this is true for UltraEdit.
If the project source code is large, we recommend that you use the MacOS X (Samba server) + window (SourceInsight) mode. The biggest problem is that SourceInsight doesn't know much about Object-C syntax.
If there are only a few small files in the project, I suggest using the FTP open mode of UltraEdit directly. this mode supports Object-C syntax recognition. In addition, the FTP mode is not prone to disconnection, And the disconnection does not affect the UltraEdit operation.
- MacOS X(FTP Server) +Windows(UtlraEdit)
Iii. debugging technology:
Most commonly, NSLog is output like printf. It will be output to the GDB Console in XCode.
Reference http://wangjun.easymorse.com /? P = 757
NSLog Definition
NSLog is defined in NSObjCRuntime. h, as follows:
- void NSLog(NSString *format, …);
Basically, NSLog is similar to printf and will also output the display result on the console. The difference is that the formatted characters passed in are NSString objects rather than chat * string pointers.
Example
NSLog can be used as follows:
- NSLog (@”this is a test”);
- NSLog (@”string is :%@”, string);
- NSLog (@”x=%d, y=%d”, 10, 20);
However, the following statement cannot be used:
- int i = 12345;
- NSLog( @”%@”, i );
The reason is that % @ needs to display the object, while int I is obviously not an object. to display the object correctly, write it:
- int i = 12345;
- NSLog( @”%d”, i );
Format
The NSLog format is as follows:
- % @ Object
-
- % D, % I integer
-
- % U unsigned integer
-
- % F floating point/double-Character
-
- % X, % X binary integer
-
- % O octal integer
-
- % Zu size_t
-
- % P pointer
-
- % E floating point/double-word scientific computing)
-
- % G floating point/double-Character
-
- % S C string
-
- %. * S Pascal string
-
- % C characters
-
- % C unichar
-
- % Lld 64-bit long)
-
- % Llu unsigned 64-bit long integer
-
- % Lf 64-bit dual-Character
When you call the console to run a simulator or connect to a real machine, click the GDB button to view the NSSLOG output.
4. Add a macro definition in the project
XCodeBefore Version 2.2, you can add macro definitions directly in the Project Settings. Under this interface.
In 2.2, there are two ways to add a macro definition:
One is to add a macro definition directly in <project_name> _ Prefix. pch. This file will be automatically referenced by all macros.
This is the default content.
- //
- // Prefix header for all source files of the 'iphone.socket' target in the 'iphone.socket' project
- //
- #ifdef __OBJC__
- #import <Foundation/Foundation.h>
- #import <UIKit/UIKit.h>
- #endif
- #define TARGET_OS_IPHONE 1
Another method is to compile the compiler group in GCC.
Summary: DetailsIPhoneThe basic development skills of the application have been introduced. I hope this article will help you.