Post

Replies

Boosts

Views

Activity

How to install self signed certificate to iPhone simulator running iOS 18.5?
I am trying to communicate with the backend of my project. So I need to install the certificate into the simulator. I have the .pem file but when I drag-dropped it into the simulator, I got the error "Simulator device failed to complete the requested operation.". The simulator is an iPhone 16 Pro running iOS 18.5. Is there any way to install the cert to my simulator? PS: I can't use Apple Configurator or MDM because I am using the office's Mac. And I can't install anything there. So I can only do it manually.
3
0
253
Nov ’25
Error `Type of expression is ambiguous without a type annotation` when trying to create a Task.
Hi, I've got this view model that will do a search using a database of keywords. It worked fine when the SearchEngine wasn't an actor but a regular class and the SearchResult wasn't a Sendable. But when I changed them, it returned Type of expression is ambiguous without a type annotation error at line 21 ( searchTask = Task {). What did I do wrong here? Thanks. protocol SearchableEngine: Actor { func searchOrSuggest(from query: String) -> SearchResult? func setValidTitles(_ validTitles: [String]) } @MainActor final class SearchViewModel: ObservableObject { @Published var showSuggestion: Bool = false @Published var searchedTitles: [String] = [] @Published var suggestedKeyword: String? = nil private var searchTask: Task<Void, Never>? private let searchEngine: SearchableEngine init(searchEngine: SearchableEngine) { self.searchEngine = searchEngine } func search(_ text: String) { searchTask?.cancel() searchTask = Task { guard !Task.isCancelled else { return } let searchResult = await searchEngine.searchOrSuggest(from: text) ?? .notFound guard !Task.isCancelled else { return } await MainActor.run { switch searchResult { case let .searchItems(_, items): showSuggestion = false searchedTitles = items.map(\.title) suggestedKeyword = nil case let .suggestion(keyword, _, items): showSuggestion = true searchedTitles = items.map(\.title) suggestedKeyword = keyword case .notFound: showSuggestion = false searchedTitles = [] suggestedKeyword = nil } } } } }
1
0
551
Oct ’25
How to run XCode 15.2 on Sequoia?
Hi, I have a project that is based on a GPL library. The GPL library has some issue since early 2024 that requires it to be run on XCode 15.2. Any XCode above 15.2 will only give you "Invalid MinimumOSVersion." and "Missing Info.plist value." errors. So I installed 15.2 again. But now I have another problem because it can only run on Ventura. How do I run XCode 15.2 on my Sequoia MacOS? I hate to reinstall the OS all again. Thank you.
2
0
137
Apr ’25
RxSwift Driver got fatal error in Swift Testing because it is not called form main thread.
Hi, I'm trying the new Swift Testing instead of XCTest for my new project. I am using RxSwift+UIKit. And when I am trying to test my ViewModel that has a Driver in it, it crashes due to the driver is not being called form main thread. Thread 5: Fatal error: `drive*` family of methods can be only called from `MainThread`. Here is the test code: struct PlayerViewModelTest { @Test func testInit_shouldPopulateTable_withEmpty() async throws { // Arrange let disposeBag = DisposeBag() var expectedSongTableCellViewData: [SongTableCellViewData]? // Act let sut = PlayerViewModel(provideAllSongs: { return .just(mockSongList) }, provideSongByArtist: { _ in return .just(mockSongList) }, disposeBag: disposeBag) sut.populateTable .drive(onNext: { expectedSongTableCellViewData = $0 }) .disposed(by: disposeBag) // Assert #expect(expectedSongTableCellViewData != nil, "Should emit something so it should not be nil") #expect(expectedSongTableCellViewData!.isEmpty, "Should emit empty array") } } This never happen in XCTest. So I assume Swift Testing is not being run in the main thread? How do I fix this? Thanks
1
0
121
Mar ’25
How to make speech recognition more accurate?
Hi, I'm using the Speech library to get speech recognition from AVAudioRecorder and store the text to database. However, most of the time it is not accurate. Heck, even "test 123" gave me entirely different words (eg. "this one till three", "this one ticket", etc). The funny thing was, it was correct a few times when it was still progressing, but then it changed into the wrong final words. So, how do I increase the accuracy of it? This is what I got as the settings:           try audioSession.setCategory(.record, mode: .spokenAudio, options: .duckOthers)          try audioSession.setActive(true, options: .notifyOthersOnDeactivation)      let recorderSettings: [String:Any] = [       AVFormatIDKey: NSNumber(value: kAudioFormatAppleLossless),        AVSampleRateKey: 44100.0,        AVNumberOfChannelsKey: 1,        AVEncoderAudioQualityKey: AVAudioQuality.max.rawValue     ] Is there anything else to improve? Thank you.
0
0
874
Dec ’22
How to set the navigation bar's back bar button without using UIBarButtonItem.appearance
I have a custom UINavigationController like so: class CustomNavigationController: UINavigationController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. delegate = self setupDefaultAppearance() } private func setupDefaultAppearance() { UINavigationBar.appearance().tintColor = R.color.textBlack() let titleAttributes: [NSAttributedString.Key: Any] = [ .font: R.font.interMedium(size: 18)! ] UINavigationBar.appearance().titleTextAttributes = titleAttributes // Hide the title in bar button items let backButtonAttributes: [NSAttributedString.Key: Any] = [ .font: UIFont(name: "Helvetica-Bold", size: 0.1)!, .foregroundColor: UIColor.clear] UIBarButtonItem.appearance().setTitleTextAttributes(backButtonAttributes, for: .normal) UIBarButtonItem.appearance().setTitleTextAttributes(backButtonAttributes, for: .highlighted) } } However, the code to hide the title in bar button items screwed IQKeyboardManager. The Done button (or any button on the toolbar) in the keyboard or any picker view is gone now because of this. So, I believe I should not use the UIBarButtonItem.appearance() static func. How do I remove the title of the Navigation Controller's back button without making the bug in the keyboard and picker views? Thanks.
1
0
1.1k
Sep ’22
XCode team suddenly missing
Hi, I'm using XCode 13.4.1 and the team is suddenly gone. I have two accounts on my XCode. One is my personal account, the other one is my office account. The one missing is the office account. The last time I checked, it was working fine then I downloaded and opened the AVCam project and it's gone. I'm sure it is still in the Keychain. What should I do? Thanks.
1
0
863
Sep ’22
Crash due to AuthenticationServices in <iOS 13 simulators
Hi, I'm implementing Apple Sign In in my project and when I tried running it in iOS 11 simulator (to check whether the sign in button and all the AuthenticationServices functionalities are gone), it crashed. It said this in the console: dyld: Library not loaded: /System/Library/Frameworks/AuthenticationServices.framework/AuthenticationServices  Referenced from: /Users/bawenang/Library/Developer/CoreSimulator/Devices/D75148B2-C894-4230-A550-D865FAD1B70C/data/Containers/Bundle/Application/7C3BA89A-C072-467A-821D-01467596757E/Kolibree.app/Kolibree  Reason: no suitable image found. Did find: /System/Library/Frameworks/AuthenticationServices.framework/AuthenticationServices: mach-o, but not built for iOS simulator If it's iOS 13 or 14, it worked fine though (except for the other bug in simulator that I've mentioned here). - https://developer.apple.com/forums/thread/676571?answerId=667630022#667630022 How do I fix this? BTW, I'm using XCode 12.
0
0
757
Mar ’21
Apple Sign In stuck on simulator
Hi, I'm currently trying to develop Sign In with Apple feature. I'm testing it on simulators because I don't have any device that has iOS 13 in it (my phone is only an iPhone 6). And when I tried the Apple Sign In button, it stuck on the screen where we need to input the password. The activity indicator is always turning non stop and it didn't return either success or error. I'm pretty sure the password I inputted is correct. This is what I've done so far: Implement AuthenticationServices Set the ASAuthorizationControllerDelegate to handle return value from Apple Thanks.
1
0
2.3k
Mar ’21