Highlights and solutions for problems in iPhone application development

Source: Internet
Author: User

IPhoneThe highlights and solutions of problems in application development are described in this article. They mainly explain some of the problems we encounter during the development process. Let's look at the content and solutions.

I. NSBundle used in IPhone application development

The NSBundle object can obtain the attachment of the application installation directory.

The attachment contains all files in the current application. Images, attribute lists, etc)

Get XML file

 
 
  1. NSString *filePath = [[NSBundle mainBundle] pathForResouse:@"re" ofType:@"xml"];  
  2. NSData *data = [[NSData alloc] initWithContentsOfFile:filePath];   

Get attribute list

 
 
  1. NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:[  
  2. [NSBundle mainBundle] pathForResource:@"ViewControllers" ofType:@"plist"]]; 

2. Solve the archive error of Xcode 4 "xxx does not contain a single-bundle application or contains multiple products"

Xcode4. recompile the static library and package it into a package as a deployable product. Generally, a package can only contain one deployable product.

1. Open the static library project. Find Deployment Group in Build Settings,

Select a dependent project in the project navigation area

2. Locate the Skip Install and change it to YES,

Dependent project's settings in Xcode 4

3. If multiple dependent projects exist, repeat the preceding settings.

Note:

The primary App needs to be deployed, so do not set the Skip Install to YES. You only need to change the dependency project.

3. Implement image slides in UIImageView

 
 
  1. NSArray * myImages = [NSArray arrayWithObjects:
  2. [UIImage imageNamed: @ "Image1.png"],
  3. [UIImage imageNamed: @ "Image2.png"],
  4. [UIImage imageNamed: @ "Image3.png"],
  5. [UIImage imageNamed: @ "mage4.gif"],
  6. Nil];
  7.  
  8. UIImageView * myAnimatedView = [UIImageView alloc];
  9. [MyAnimatedView initWithFrame: [self bounds];
  10. MyAnimatedView. animationImages = myImages;
  11. MyAnimatedView. animationDuration = 0.35; // seconds
  12. MyAnimatedView. animationRepeatCount = 0; // 0 indicates a loop.
  13. [MyAnimatedView startAnimating];
  14. [Self addSubview: myAnimatedView];
  15. [MyAnimatedView release];

4. Change the project name in Xcode

I recently started iPhone development and encountered a small problem, that is, how to modify the name of my project. All Versions earlier than xcode3.2 must be modified manually, in version 3.2, you can directly modify the Rename under the Xcode Project.

1. Next I will explain how to modify it in Xcode 3.1.

2. Disable the project you want to modify in Xcode. You 'd better disable Xcode first.

3. Copy your project and use command D or copy and paste to get a copy folder.

4. Modify the name of the copy folder, that is, the name of the project you want.

5. Open the folder, find the file with the suffix ". xcodeproject", and rename it.

6. Delete the "Build" folder and all files in it.

7. open the file with the suffix ". xcodeproject", which is the same as opening the project.

8. In the "Groups & Files" list on the left of Xcode, find the file named "*-Info. plist" and change its name.

9. Modify the name of the file with the suffix * _ Prefix. pch.

10. Expand the "Targets" group, double-click the Target file name, and modify its name in the "General"-tab. In the "Build" tab, modify the Project Name (for all configurations). If the Project Name is changed, the file Name suffixed with. app is automatically modified. In the Build tab, modify "*-Info. plist" and * _ Prefix. pchPrefix Header values ).

11.XcodeClean All Targets.

12. Finally, Build and Go again. In this way, the project name is modified.

Summary:IPhoneI hope this article will help you understand the highlights and solutions of problems in application development!

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.