Post

Replies

Boosts

Views

Activity

IOS 17 UserDefaults doesnt work as intented sharing data beetween app and widgetkit
Hi, I have an app that contains widgetkit elements. I have appgroup and everything used work fine before ios 17 and xcode 15 I was using suitname pattern like group.MY_TEAM_ID.com.xxxx.xxxxx and there was no problem with it. now xcode 15 complains like Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd. when I change suitname group.com.xxxx.xxxxx or any other suitname. I see data saved to userdefaults but reading data from widget site returns nil all the time.
2
2
1.4k
Sep ’23
AVAudiosession with allowbluetooth option prevents to listen bluetooth button events
I have a VoIP call application. I m trying to add functionality that when the user connected bluetooth to device and hit the bluetooth button call might be answered. I added options that when incoming call received incoming ring should play in bluetooth also. let audioSession = AVAudioSession.sharedInstance() try audioSession.setCategory(AVAudioSession.Category.playAndRecord, mode: .spokenAudio, options:[.defaultToSpeaker,.allowBluetooth,.allowBluetoothA2DP]) try audioSession.setActive(true, options: .notifyOthersOnDeactivation) and I added MPCommandCenter to listen bluetooth events ; let rcCenter = MPRemoteCommandCenter.shared() rcCenter.nextTrackCommand.isEnabled = false rcCenter.nextTrackCommand.addTarget { _ in return .success } rcCenter.previousTrackCommand.isEnabled = false rcCenter.previousTrackCommand.addTarget { _ in return .success } rcCenter.togglePlayPauseCommand.isEnabled = true rcCenter.playCommand.isEnabled = true rcCenter.pauseCommand.isEnabled = true rcCenter.stopCommand.isEnabled = true rcCenter.togglePlayPauseCommand.addTarget{ [unowned self] event in print("togglePlayPauseCommand") return.commandFailed } rcCenter.playCommand.addTarget{ [unowned self] event in print("playCommand") return.commandFailed } rcCenter.pauseCommand.addTarget{ [unowned self] event in print("pause") return.commandFailed } rcCenter.stopCommand.addTarget{ [unowned self] event in print("stop") return.commandFailed } When I remove bluetooth related options from audioSession.setCategory I can listen to events. But when I put them again, events don't work. I also tried UIResponder but had no success; UIApplication.shared.becomeFirstResponder() UIApplication.shared.beginReceivingRemoteControlEvents() and override func remoteControlReceived(with event: UIEvent?) { if let rc = event?.subtype{ print("OVER HERE") } } any idea will be appreciated.
0
1
897
Aug ’21