0

Due to an unresolved Cocoapod issue, I'm manually embedding the Alamofire framework into my app using these instructions. So, my steps were:

  1. Adding Alamofire as a git submodule to my app
  2. Adding the Alamofire.xcodeproj to my app's workspace
  3. Adding the iOS Alamofire.framework as an Embedded Binary to my project

Despite this, I am still running into "Use of unidentified type" errors:

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)
        }
    }
}

How would I resolve this issue?

DevelopMe
  • 1
  • 2

1 Answers1

2

Late, but spent several hours with the same issue from AWS framework and tried a bunch of solutions listed in previously asked questions from years ago about the same error: "Use of undeclared type" in Swift, even though type is internal, and exists in same module

What ended up working for me was keeping the Target Membership (located in right sidebar of file) unchecked -- as opposed to unchecking and rechecking as some suggested. All my errors are gone and the project builds fine.

I'm not completely clear on the function of target memberships and why all my other files need it except this one, but based on readings I think it might be because that particular .swift file is a header file: Xcode: Which files need to be members of my target? (Target Membership)

Hope this helps.

tameikal
  • 166
  • 1
  • 6