Basic iPhone application development skills

Source: Internet
Author: User
Tags ultraedit

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.

 
 
  1. 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:

 
 
  1. 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:

 
 
  1. NSLog (@”this is a test”);  
  2. NSLog (@”string is :%@”, string);  
  3. NSLog (@”x=%d, y=%d”, 10, 20); 

However, the following statement cannot be used:

 
 
  1. int i = 12345;  
  2. 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:

 
 
  1. int i = 12345;  
  2. NSLog( @”%d”, i ); 

Format

The NSLog format is as follows:

 
 
  1. % @ Object
  2.  
  3. % D, % I integer
  4.  
  5. % U unsigned integer
  6.  
  7. % F floating point/double-Character
  8.  
  9. % X, % X binary integer
  10.  
  11. % O octal integer
  12.  
  13. % Zu size_t
  14.  
  15. % P pointer
  16.  
  17. % E floating point/double-word scientific computing)
  18.  
  19. % G floating point/double-Character
  20.  
  21. % S C string
  22.  
  23. %. * S Pascal string
  24.  
  25. % C characters
  26.  
  27. % C unichar
  28.  
  29. % Lld 64-bit long)
  30.  
  31. % Llu unsigned 64-bit long integer
  32.  
  33. % 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.

 
 
  1. //  
  2. // Prefix header for all source files of the 'iphone.socket' target in the 'iphone.socket' project  
  3. //  
  4. #ifdef __OBJC__  
  5.     #import <Foundation/Foundation.h> 
  6.     #import <UIKit/UIKit.h> 
  7. #endif  
  8. #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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.