hmlongco / Factory

A new approach to Container-Based Dependency Injection for Swift and SwiftUI.
MIT License
1.88k stars 115 forks source link

Can not build app for deivce ios 15 when import Factory #163

Closed toaindt-3169 closed 1 year ago

toaindt-3169 commented 1 year ago

When I used Factory in my SwiftUI project, it failed to build on devices running iOS 14 and iOS 15. Very pleased with your response!

toaindt-3169 commented 1 year ago

Home screen only white background.

hmlongco commented 1 year ago

Haven't had any issues building to device, nor any other reports of such. Not enough information here to debug issue.

toaindt-3169 commented 1 year ago

Your demo application. When I build them on iOS 15, the screen is white and the app doesn't run. This is the same when I first installed Factory using SPM and my configuration was as follows:

     var sessionManager: Factory<URLSessionManager> {
          return self { BaseSessionManager(base: self.baseUrl, session: self.urlSession())
              .set(decoder: JSONDecoding())
              .set(encoder: JSONEncode())
              .interceptor(URLRequestInterceptorHeaders([
                  "Authorization": self.authorization()
              ]))
      }.singleton
  }

  var private urlSession: Factory<URLSession> {
      let configuration = URLSessionConfiguration.default
      config.timeoutIntervalForRequest = Const.timeout
      config.timeoutIntervalForResource = Const.timeout
      return self { URLSession(configuration: config) }.singleton
  }

  private var baseUrl: URL? {
      return URL(string: APIService.Urls.baseUrl)
  }

  private function delegate() -> String {
      let username = APIService.Authorization.username
      let password = APIService.Authorization.password
      let credential = Data("\(username):\(password)".utf8).base64EncodedString()
      returns "Basic\(credentials)"
  }

Can you please give me the configuration when running the application without the same situation as mine? Screenshot 2023-11-06 at 08 24 55

hmlongco commented 1 year ago

I'd pushed a project change up earlier today as the demo app didn't have the common framework as part of its included libraries. Pull the main branch.

toaindt-3169 commented 1 year ago

Thank you so much!