Post

Replies

Boosts

Views

Activity

Reply to Debugging Big Sur kernel on inter-based macbook from Monterey on m1
Forget about what I have said earlier. I tried to migrate the python scripts from 2 to 3, and I tested the showallkexts command, it won't work. I managed to do it by simply DELETE the old python scripts folder, and copy the newer python tools from my Sonoma KDK to Catalina dSYM folders. sudo cp -r /Library/Developer/KDKs/KDK_14.2_23C5047e.kdk/System/Library/Kernels/kernel.development.dSYM/Contents/Resources/Python /Library/Developer/KDKs/KDK_10.15.7_19H1824.kdk/System/Library/Kernels/kernel.development.dSYM/Contents/Resources/ The showallkexts command works now with python3
Mar ’24
Reply to Debugging Big Sur kernel on inter-based macbook from Monterey on m1
I ran into this issue today when debugging with 10.15.7 Catalina target with newer host machine Sonoma. These python scripts are very important. When they are not loaded successfully, kdp related commands like showallkexts are missing. So, in order to run these python scripts, we can either install python2 or modified these python scripts in HOST machine. I chose to modify the scripts. First, install 2to3 python tools by: pip3 install 2to3 Second, add 2to3 directory to PATH variable if not yet or using absoulte path to call 2to3 command Third, run 2to3 to convert all python scripts under directory /Library/Developer/KDKs/KDK_10.15.7_19H1824.kdk/System/Library/Kernels/kernel.development.dSYM/Contents/Resources/Python(Change to fit your enviroment) sudo 2to3 -w <Python path> Last, solve any Python problems if occur during debugging.
Mar ’24
Reply to A BUG of UITextView Delegate Method
SAME TextKit BUG on iPhone13 running iOS 17.1.2 When UITextView contains an attachment ahead and select the rest of the text without the attachment, the delegate method's range parameter is obviously wrong! Code for bug reproduction: // // TestViewController.swift // Notes // // Created by laishere on 2023/12/13. // import UIKit class TestViewController : UIViewController { override func viewDidLoad() { super.viewDidLoad() initView() } private func initView() { let textView = UITextView(frame: view.bounds) textView.translatesAutoresizingMaskIntoConstraints = false view.addSubview(textView) NSLayoutConstraint.activate([ textView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), textView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor), textView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor), textView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor), ]) textView.delegate = self let attachment = NSTextAttachment(image: UIImage(systemName: "sun.max.fill")!) textView.textStorage.insert(NSAttributedString(attachment: attachment), at: 0) let str = NSMutableAttributedString(string: "hello") str.addAttribute(.foregroundColor, value: UIColor.systemBlue, range: NSRange(location: 0, length: str.length)) textView.textStorage.insert(str, at: 1) } } extension TestViewController : UITextViewDelegate { func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { let sel = textView.selectedRange if sel != range { print("total text count: \(textView.text!.count), replacing range: \(range), selected range: \(sel)") } return true } func textViewDidChange(_ textView: UITextView) { print("text: \(textView.text!), count: \(textView.text!.count)") } } Reproduction procedure: Run the TestViewController Select hello Press delete key See the delegate params output As you can see in the above image, the selected range is {1, 5}, but the delegate param range is {0, 6}. However, despite the delegate method tells us it want to replace the whole 6 characters with empty string, the actual number of deleted characters is 5. One charater which is the attachment charater is left as you can see in the output of textViewDidChange delegate method.
Topic: UI Frameworks SubTopic: UIKit Tags:
Dec ’23