hmlongco / Factory

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

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

Closed toaindt-3169 closed 8 months ago

toaindt-3169 commented 8 months 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 8 months ago

Home screen only white background.

hmlongco commented 8 months 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 8 months 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 8 months 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 8 months ago

Thank you so much!