2017-02-27 62 views
0

「未申報類型的錯誤使用」由於一個懸而未決的問題Cocoapod,我使用這些instructions手工嵌入Alamofire架構到應用中。所以,我的步驟是:IOS - 試圖在Xcode中使用嵌入式框架給出了

  1. 添加Alamofire作爲一個git子模塊,以我的應用程序
  2. 添加Alamofire.xcodeproj到我的應用程序的工作區
  3. 添加了iOS Alamofire.framework作爲嵌入式二進制到我的項目

儘管這樣,我仍然在運行到 「使用不明類型的」 錯誤:

import Foundation 
import Alamofire 

// Retry a request every x seconds 
class AutoRetrier: RequestRetrier{ 

    //MARK: Properties 
    private var maxRetries: Int 
    private var timeInterval: TimeInterval 

    init(times maxRetries:Int, interval:TimeInterval){ 
     self.maxRetries = maxRetries 
     self.timeInterval = interval 
    } 

    //MARK: RequestRetrier 

    func should(_ manager: SessionManager, retry request: Request, with error: Error, completion: @escaping RequestRetryCompletion) { 

     // We're basically ignoring what type of error it is, and just retrying a number of times 
     if request.retryCount <= UInt(maxRetries){ 
      completion(true, timeInterval) 
     } else{ 
      completion(false, 0.0) 
     } 
    } 
} 

我該如何解決這個問題?

回答

0

晚,但花了幾個小時與AWS框架同樣的問題,並試圖一堆中列出的解決方案以前問從年前大約相同的錯誤問題:"Use of undeclared type" in Swift, even though type is internal, and exists in same module

什麼結束了工作對我來說是保持目標成員資格(位於文件的右側)未經檢查 - 與某些人建議的取消選中和重新檢查相反。我所有的錯誤都消失了,項目建立良好。

我不是目標成員的功能,爲什麼我的所有其他文件都需要它,除非這個完全清楚,但基於閱讀我想可能是因爲特定的.swift文件是一個頭文件:Xcode: Which files need to be members of my target? (Target Membership)

希望這會有所幫助。