Finally fixed this by changing name of my Xcode app from Xcode(12.3) to Xcode\_12\_3 so it seems that the problem was in characters that needs to be escaped. So if anyone has brackets or quotas in their path to Xcode, check this.
Post
Replies
Boosts
Views
Activity
Decided to update my toolchains today. Moved from Xcode 12.0 to 12.2 and now I'm experiencing the same issue. Very frustrating. The same "Cannot create Swift scratch context (couldn't create a ClangImporter)" for Version 12.2 (12B45b) and Version 12.3 (12C33).
I'm with you guys. I have one month subscription in-app purchase, initial purchase works OK, auto-renewals works OK, but when all automatic renewals are proceeded, so it becomes actually "expired" subscription, then when I try to renew this subscription manually it sometimes gives me this error (and sometimes doesn't!) in SKPaymentTransactionObserver .
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction])
(lldb) po transactions[0].error
▿ Optional<Error>
	- some : Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x28216fed0 {Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x28216e460 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, NSLocalizedFailureReason=The response has an invalid status code}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}}}
OK, after a lot of research I've tried RxSwift because I thought that observing text in reactive paradigm framework should succeed in 100% cases. And it worked without any issues!
inputTextView.rx.text.subscribe(onNext: { string in
		print("rx: \(string)")
})
So it seems that these guys have found the solution.
https://github.com/ReactiveX/RxSwift/blob/master/RxCocoa/iOS/UITextView%2BRx.swift
And here is the solution that gives you information about all text changes despite of auto correction, text selection, and etc..
class ViewController: UIViewController {
		@IBOutlet weak var inputTextView: UITextView!
		override func viewDidLoad() {
				super.viewDidLoad()
				inputTextView.textStorage.delegate = self
		}
}
extension ViewController: NSTextStorageDelegate {
		func textStorage(_ textStorage: NSTextStorage, didProcessEditing editedMask: NSTextStorage.EditActions, range editedRange: NSRange, changeInLength delta: Int) {
				print("string: \(textStorage.string)")
		}
}
Yeah, I tried delegate approach, it works the same as Notifications.
I've described problem with shouldChangeTextIn. iOS auto correction won't inform you about it's work in shouldChangeTextIn. For example when you double tap space button, probably you will see dot instead of first space and this information about dot insertion doesn't go to shouldChangeTextIn.