|
143 | 143 | }
|
144 | 144 |
|
145 | 145 | // TODO: resolve https://github.com/firebase/firebase-ios-sdk/issues/10921
|
146 |
| - if Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt" { |
147 |
| - // Distributed via TestFlight |
148 |
| - return defaultAppTypeProd |
149 |
| - } |
| 146 | + // to support TestFlight |
150 | 147 |
|
151 |
| - let path = Bundle.main.bundlePath + "embedded.mobileprovision" |
152 |
| - guard let url = URL(string: path) else { |
153 |
| - AuthLog.logInfo(code: "I-AUT000007", message: "\(path) does not exist") |
154 |
| - return defaultAppTypeProd |
155 |
| - } |
| 148 | + let path = Bundle.main.bundlePath + "/" + "embedded.mobileprovision" |
156 | 149 | do {
|
157 |
| - let profileData = try Data(contentsOf: url) |
| 150 | + let profileData = try NSData(contentsOfFile: path) as Data |
158 | 151 |
|
159 | 152 | // The "embedded.mobileprovision" sometimes contains characters with value 0, which signals
|
160 | 153 | // the end of a c-string and halts the ASCII parser, or with value > 127, which violates
|
|
177 | 170 |
|
178 | 171 | let scanner = Scanner(string: embeddedProfile)
|
179 | 172 | if scanner.scanUpToString("<plist") != nil {
|
180 |
| - guard let plistContents = scanner.scanUpToString("</plist>"), |
| 173 | + guard let plistContents = scanner.scanUpToString("</plist>")?.appending("</plist>"), |
181 | 174 | let data = plistContents.data(using: .utf8) else {
|
182 | 175 | return defaultAppTypeProd
|
183 | 176 | }
|
|
194 | 187 | message: "Provisioning profile has specifically provisioned devices, " +
|
195 | 188 | "most likely a Dev profile.")
|
196 | 189 | }
|
197 |
| - guard let apsEnvironment = plistMap["Entitlements.aps-environment"] as? String else { |
| 190 | + guard let entitlements = plistMap["Entitlements"] as? [String: Any], |
| 191 | + let apsEnvironment = entitlements["aps-environment"] as? String else { |
198 | 192 | AuthLog.logInfo(code: "I-AUT000013",
|
199 | 193 | message: "No aps-environment set. If testing on a device APNS is not " +
|
200 | 194 | "correctly configured. Please recheck your provisioning profiles.")
|
|
0 commit comments