Next

Previous
Troubleshooting
故障排除
If you have trouble getting the BirdWatching app to work correctly, try the problem-solving approaches described in this chapter.
如果BirdWatching app運行的時候有問題,嘗試本章中描述的解決問題的辦法。
Code and Compiler Warnings
代碼和編譯器警告
If the app isn’t working as it should, first compare your code with the code in “Code Listings.”
如果app沒有如它應該的那樣運行,首先將你的代碼和代碼清單中的代碼進行比較。
The tutorial code should compile without any warnings. If Xcode reports a warning, it’s a good idea to treat the warning in the same way that you treat errors. Objective-C is a very flexible language, and sometimes a warning is the only indication you receive when there is an issue that might cause an error.
本教程的代碼應該沒有任何編譯器警告。如果Xcode報告警告,與處理錯誤一樣的方式來處理這些警告是一個好主意。Objective-C是非常靈活的語言,有時候一個警告僅僅是一個跡象,告訴你那兒有問題它可能會導致錯誤。
Storyboard Items and Connections
故事板項和連接
When you’re accustomed to fixing all of an app’s problems in code, it’s easy to forget to check the objects in the storyboard. A great advantage of a storyboard is that, because it captures both the appearance and some of the configuration of app objects, you have less coding to do. To benefit from this advantage, it’s important to examine the storyboard, as well as the code, when an app doesn’t behave as you expect. Here are some examples.
當你已經習慣了修復代碼中的所有的app問題時,人們很容易忘記在故事板中檢查對象。故事板的一個很大的優(yōu)勢是,因為它同時獲取對象的外觀以及對象的一些配置,你僅需要很少的代碼。受益于這種優(yōu)勢,檢查故事板顯得非常重要,就像檢查代碼一樣,當app不能如你希望般起作用。這兒有一些例子。
A scene does not seem to receive the data you send to it in the prepareForSegue method. Check the segue’s identifier in the Attributes inspector. If you forget to give the segue the same identifier that you use in the prepareForSegue method, you can still transition to the scene during testing, but the scene won’t display the data that you send to it.
一個場景似乎沒有接收到你通過prepareForSegue方法發(fā)送給它的數(shù)據。在屬性檢查器中檢查segue的標識符。如果你忘了給segue和你在prpareForSegue方法里面使用的相同的標識符,你在測試的時候仍然能轉換到場景,但是場景不能顯示你發(fā)送的數(shù)據。
The same result occurs when you misspell a segue’s identifier in the prepareForSegue method. Xcode does not warn you when a segue is missing its identifier, or when the prepareForSegue method uses an incorrect identifier, so it’s important to check these values for yourself.
相同的結果也放生在當你在prepareForSegue方法里拼寫了錯誤的segue標識符。當segue缺失標識符的時候,或者當prepareforSegue方法使用不正確的標識符的時候,Xcode不會有警告,所以,自己檢查這些值非常重要。
None of your changes to a custom view controller class seem to affect its scene. Check the scene’s class in the Identity inspector. If the name of your custom view controller class is not displayed in the Class pop-up menu, Xcode does not apply your changes to the scene.
自定義視圖控制器類中做出的改變似乎沒有影響到到場景。在身份檢查器中檢查場景的類。如果你的自定義視圖控制器類的名師沒有顯示在Class彈出菜單里面,Xcode沒有應用你的改變到這個場景。
Nothing happens when you click the Cancel or Done buttons in the add scene’s navigation bar. Make sure each button is connected to its unwind action. Control-click the button on the canvas or in the document outline and confirm that the connection in the Triggered Segues section is active and correct.
當你點擊add 場景的導航條上的Done或者Cancel按鈕的時候沒有任何動作。確保每個按鈕已經聯(lián)系到它的unwind action。在畫布中或賊文檔大綱中按住Control并點擊這個按鈕,并在Triggered Segues部分去人連接是被正確觸發(fā)的。
the text fields appear to work, but the data you enter is not displayed in the master list. Make sure the view controller’s outlets are connected to the text fields.
文本字段使工作的,但你輸入的數(shù)據沒有顯示在主列表。確保視圖控制器的outlets已經連接到文本字段。
Delegate Method Names
委托方法名字
A common mistake related to using delegates is to misspell the delegate method name. Even if you’ve set the delegate object correctly, if the delegate doesn’t use the right name in its method implementation, the correct method won’t be invoked. It’s usually best to copy and paste delegate method declarations—such as textFieldShouldReturn:—from a reliable source (such as the documentation or the declaration in a header file).
使用代理的常見錯誤是拼錯委托方法的名字。即使你正確的設置了代理對象,如果在代理沒有在方法實現(xiàn)中使用正確的名字,正確的方法將不被調用。通常最好的方法是從可靠的來源(例如文檔或者頭文件里的聲明)復制粘貼代理方法聲明——例如textFieldShouldReturn:。
Next
Previous
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
標題名稱:yourSecondiOSApp(5)—Troubleshooting-創(chuàng)新互聯(lián)
文章起源:http://www.jbt999.com/article12/dseidc.html
成都網站建設公司_創(chuàng)新互聯(lián),為您提供微信小程序、定制網站、軟件開發(fā)、App設計、網站維護、網站策劃
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:[email protected]。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內容