iCloud6_Troubleshooting

故障排除Troubleshooting

如果你在应用运行时出现问题,尝试本章讲到的 问题-解决 途径。If you have trouble getting your app to work correctly, try the problem-solving approaches described in this chapter.

 

诊断必须提供的配置文件问题Diagnosing Provisioning Profile Issues

如果代码编译通过,但是安装到设备(真机)时出错,需要查看应用的诊断信息。If you are able to compile your code but the build fails to install on your device, you need to check the provisioning information for your app.

  • 如果你不能在设备上安装应用,查看代码签名身份标识构建的值设置,确保设置正确的诊断配置文件。If you are unable to install the app on a device, check the value for the Code Signing Identity build setting and make sure it is set to the correct provisioning profile.

  • 如果配置概要文件出现有效,你可以查看可用的If the provisioning profile shows up as invalid, make sure you have the correct development certificates installed on the current machine. You can check the available certificates using the Keychain Access application.

  • 如果在代码签名标识弹出菜单中配置概要文件出现但不可用,确保你正确发展项目,匹配文件中的包的标示符。如果初始化证书与选择的配置概要文件不匹配。If the provisioning profile appears disabled in the Code Signing Identity pop-up menu, make sure the bundle identifier of your project matches the bundle identifier in the provisioning profile. Profiles can also appear disabled if the installed certificates do not match the ones selected for the provisioning profile.

 

诊断iCloud可能性的问题Diagnosing iCloud Availability Issues

当你的应用调用了 URLForUbjquityContainerIdentifier方法来检索 iCloud 容器目录,如果每件事都是正确的配置,那么方法返回一个有效的 URL 。如果方法返回 nil,可以是如下原因造成的:When your app calls the URLForUbiquityContainerIdentifier: method to retrieve the iCloud container directory, that method should return a valid URL if everything is configured correctly. If the method returns nil, it could be for one of the following reasons:

  • 设备没有与一个 iCloud 账号配置,或者文档&数据选择是不可用的。The device has not yet been configured with an iCloud account, or the Documents & Data option is disabled.

  • 你的应用权限配置不适用。Your app’s entitlements are not configured properly.

最可能的问题发生在开发中,是你的应用权限是没有适当配置。你应该两次查看步骤,制定在 “Getting Started” ,确保你的权限是指定正确的,你的应用ID和配置概要文件是最新的,将被用于你的 Xcode 项目。The most likely problem to occur during development is that your app’s entitlements are not configured properly. You should double-check the steps laid out in “Getting Started” to make sure your entitlements are specified correctly and that your app ID and provisioning profile are up to date and being used by your Xcode project.

 

代码和编译警告Code and Compiler Warnings

如果没有正常运行,首先要将代码与在“Code Listings” 中的完整的清单对比。If things are not working as they should, first compare your code with the complete listings in “Code Listings.”

你的代码应该编译没有任何警告。如果你收到警告,建议将他们当做错误来处理。这样做的原因是OC(面向对象C语言)是一个非常灵活的语言,这样你从编译器得到的最多的是警告。Your code should compile without any warnings. If you do receive warnings, it is recommended that you treat them as very likely to be errors. The reason for this is that Objective-C is a very flexible language, so that sometimes the most you get from the compiler is a warning.

当一个方法调用另一个方法时,这个方法被调用必须定义在方法调用它之前。如果编译器报告了一个错误,你的类没有声明一个包含给定方法名的方法,尝试重新安排方法到你的源文件来修改这个问题。除非另有声明,你应该需要包含在本指导中的方法到你的类的声明中。When one method calls another method, the method being called must be defined before the method that calls it. If the compiler reports an error that your class does not declare a method with a given selector name, try rearranging the methods in your source file to fix the problem. Except where otherwise noted, you should not need to include the methods in this tutorial in your class declarations.

 

查看Storyboard文件Check the Storyboard File

作为一个开发者,如果没有正确运行,你的自然的本能可能是查看源代码是否有错误。但是,当你用 Cocoa Touch,另一个纬度需要添加。你的应用配置更多是“编码”在 storyboard 文件中。如果你没有正确连接,应用不会如期表现As a developer, if things do not work correctly, your natural instinct might be to check your source code for bugs. But when you use Cocoa Touch, another dimension is added. Much of your app’s configuration is “encoded” in the storyboard file. If you haven’t made the correct connections, your app will not behave as you might expect.

  • 如果表格没有展现任何数据,甚至在你清楚的添加一些东西之后,你可能忘了设置主视图控制器作为表格视图的代理。If the table does not display any data, even after you explicitly add some, you might have forgotten to set the master view controller as the delegate of the table view.

  • 如果点击表格的某个单元格没有展现详细视图,确保你配置了连线。为表格移动到存在的连线在一个项目,改变内容类型,这样你就可以重建它。If tapping a cell does not display the detail view, make sure you configured the segue. Changing the content type for the table removes the existing segue in the project, so you must recreate it.

  • 如果点击添加按钮,没有期望的效果,你可能忘了连接动作方法到按钮上。If tapping the Add button does not have the desired effect, you might have forgotten to connect the action method to it.

 

通知方法名称Notification Method Names

一个共通的通知错误是,拼错了通知处理的方法名。如果注销通知观察者,你提供一个名字不同于实际方法名字,正确的方法没有调用。通常最好复制和粘贴方法名当指定处理程序时。A common mistake with notifications is to misspell the method name of the notification handler. If when registering the notification observer, you provide a name that is different from the actual method name, the correct method is not called. It is usually better to copy and paste method names when specifying the handlers.

转载于:https://www.cnblogs.com/zyingn/articles/iOS_translation15.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值