Errors and solutions frequently encountered in iPhone Development)

Source: Internet
Author: User

I believe that the kids shoes that have just started iPhone development will also be the same as me, and will often encounter some warnings or error prompts. Now I will sort out the problems as follows:

1. Warning: 'uiviewcontroller' may not respond to 'xxx'

This error is caused by the characteristics of the objc language. objc is different from Java and ,. net, flex, and other object-oriented languages, which are derived from C and have relatively strict syntax. Therefore, when defining a method, if the called method is located behind the method that calls it, it cannot be found, this prompt is reported.

Solution: at the beginning of the. M file, add

@ Interface
Uiviewcontroller()

-(Void)Xxx;

@ End

The red field is replaced with the reported warning.

Reference: http://stackoverflow.com/questions/5917747/warning-uiviewcontroller-may-not-respond-to-xxx

 


2. Warning: 'format not a string literal and no format arguments'

This error is related to the xcode version. If you use this error when developing in the system later than xcode 3.2.1:

Nslog ([nsstring stringwithformat: @ "% @, % @", errormsgformat, error, [error userinfo]);

Output logs often receive the warning "format not a string literal and no format arguments. In this case, you only need to change the call method:

Nslog ([nsstring stringwithformat: @ "% @, % @", errormsgformat, error, [error userinfo], Nil);You can.

Reference: http://sheng.iteye.com/blog/965687

3.Warning:'Failed
To launch simulated application: Unknown error'

 
Sometimes there will be an unknown error that cannot be used in the simulator. I have not figured out why this error occurs. In this case, just change the product name,
 
Generally, the problem can be solved.
Reference: http://stackoverflow.com/questions/779115/iphone-failed-to-launch-simulated-application-unknown-error
 
4.Error :'/Developer/platforms/iphonesimulator. Platform/developer/usr/bin/g ++-4.2 fail with exit code 1'

use C, C ++, and objective-c language 3C mixed programming Program , let's talk about the method as well, that is, the C language in the xcode environment. c file, C ++. CPP file and objective-C. modify all the file names of the M file. mm. In this way, you can enable the compilation environment 3C mixed editor of objective-C ++. However, when you encounter the above problems, the online statements are inconsistent, and I have encountered this problem many times, the final solution is different, so we summarize all possible situations:

1) the static method name is repeated-because there is no object concept in the C language, the method only needs to be added to the corresponding one. the H file can be used. Therefore, if it is the same as the static method of C ++ or objective-C, the environment cannot be distinguished. Obviously, this error is a compilation error, static variables and methods are added during compilation, so they cannot be identified.

  2) The global variable name is repeated for the same reason as above. Of course, if it is a global variable, we recommend that you use objective-C. M file (of course changed. mm). Otherwise, it is declared in. if C or C ++ is referenced directly. h, the above problem will occur even if the global variables are not repeated at this time.

  3) There are multiple main methods. The main method is the program entry. If multiple files contain the main method, the above problem will also occur.

  In general, this problem is caused by repeated methods or global variables that make the compilation environment unable to recognize and compile.

Original post address: http://blog.163.com/fuxiaohui@126/blog/static/131745826201182711636919/
 5. Passing argument 1 of 'objectforkey: 'from incompatible pointer type 

This warning is caused by incorrect key type. The method to remove the prompt is simple, that is, force conversion.

For example:

Set[LBL settext: [til objectforkey: objid];

Change to [LBL settext: [til objectforkey :( nsstring *) objid];

6. _ Objc_class _ $ _ mpmovieplayercontroller

This error is because the mediaplay framework is not referenced. Add it.

7._ Kuttypeimage 

This error is caused by no reference.Mobilecoreservices framework, add it.

 

 

 



 


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.