Post

Replies

Boosts

Views

Activity

App getting launched automatically
Hi, This is a very pecurliar problem. I have an audio app that plays when being launched. It has CarPlay entitlements, plays from the network and naturally plays in the background. Now, every one in a while the phone launchs the app in the background without notice. Music simply starts to play randomly. I can't determine the cause or the situation in which this reproduces. It might be related to Bluetooth connections, phone calls, CarPlay interactions, network changes or other reasons. I do know the following things for sure: The app is launched from scratch as I have examined remote logs and seen the app is being launched. Pausing the music from control center will kill the app, and it will be relaunching after 2-3 minutes again (and again) Any clues or ideas on why this happens or how to debug it further will be welcome. Thank you..!
0
0
835
May ’21
Shazam fails to find match
Hi, I'm trying to convert a stream into a PCMBuffer and then use Shazam to match. Shazam always fails to match. I have a theory it "listens" to the playback at double speed or more. Starts from here: ... let format = audioEngine.outputNode.inputFormat(forBus: 0) guard let pcmBuffer = format.toPCMBuffer(frame: currentFrame) else {          return } session.matchStreamingBuffer(pcmBuffer, at: nil) Where toPCMBuffer is: extension AVAudioFormat {     func toPCMBuffer(frame: AudioFrame) -> AVAudioPCMBuffer? {         guard let pcmBuffer = AVAudioPCMBuffer(pcmFormat: self, frameCapacity: UInt32(frame.dataWrap.size[0]) / streamDescription.pointee.mBytesPerFrame) else {             return nil         }         pcmBuffer.frameLength = pcmBuffer.frameCapacity         for i in 0 ..< min(Int(pcmBuffer.format.channelCount), frame.dataWrap.size.count) {             frame.dataWrap.data[i]?.withMemoryRebound(to: Float.self, capacity: Int(pcmBuffer.frameCapacity)) { srcFloatsForChannel in                 pcmBuffer.floatChannelData?[i].assign(from: srcFloatsForChannel, count: Int(pcmBuffer.frameCapacity))             }         }         return pcmBuffer     } } AudioFrame is: final class AudioFrame: MEFrame {     var timebase = Timebase.defaultValue     var duration: Int64 = 0     var size: Int64 = 0     var position: Int64 = 0     var numberOfSamples = 0     let dataWrap: ByteDataWrap     public init(bufferSize: Int32, channels: Int32) {         dataWrap = ObjectPool.share.object(class: ByteDataWrap.self, key: "AudioData_\(channels)") { ByteDataWrap() }         if dataWrap.size[0] < bufferSize {             dataWrap.size = Array(repeating: Int(bufferSize), count: Int(channels))         }     } ... } and MEFrame is: extension MEFrame {     public var seconds: TimeInterval { cmtime.seconds }     public var cmtime: CMTime { timebase.cmtime(for: position) } }
3
1
1.5k
Jul ’22
WeatherKit weatherFor never returns
Hi, I'm trying to work with WeatherKit. I've added the capability to the App ID as well as the capabilities in Xcode. Still after more than a day, in simulator I get 401 error, and on device even stranger - there weatherFor function is called but NEVER returns or throws an exception. try { let weatherService = WeatherService() let weather = try await weatherService.weather(for: location) print(weather) //never gets called } catch { ... // never called on device, always called on simulator Any one has an idea how to get it to work?
0
0
903
Jul ’22
API Call limitations to ShazamKit
Hi, Is there an app limit or user limit for song matches with ShazamKit? I need to know if I need to limit access or not on my app. If there is a limit, is it per user or per the entire calls made by the app? I am using the matchStreamingBuffer continiously, so it is called every few seconds (with the same match).
0
0
726
Apr ’23
matchStreamingBuffer causes an NSException
Hi, I am using ShazamKit to detect songs from a live stream. I am using matchStreamingBuffer with a PCMBuffer. It looks like it works for the most part, but sometimes it throws an NSException. Here's the code calling the match: engine.mainMixerNode.installTap(onBus: 0, bufferSize: 4096, format: options.audioFormat) { buffer, time in do { self.session.matchStreamingBuffer(buffer, at: time) } catch { } } The exception: Supplied audio format is not supported <CMAudioFormatDescription 0x2828a29e0 [0x20f7863a0]> { mediaType:'soun' mediaSubType:'lpcm' mediaSpecific: { ASBD: { mSampleRate: 44100.000000 mFormatID: 'lpcm' mFormatFlags: 0x29 mBytesPerPacket: 4 mFramesPerPacket: 1 mBytesPerFrame: 4 mChannelsPerFrame: 2 mBitsPerChannel: 32 } cookie: {(null)} ACL: {Stereo (L R)} FormatList Array: { Index: 0 ChannelLayoutTag: 0x650002 ASBD: { mSampleRate: 44100.000000 mFormatID: 'lpcm' mFormatFlags: 0x29 mBytesPerPacket: 4 mFramesPerPacket: 1 mBytesPerFrame: 4 mChannelsPerFrame: 2 mBitsPerChannel: 32 }} } extensions: {(null)} } This is the stack stack: 0 CoreFoundation 0xa248 __exceptionPreprocess 1 libobjc.A.dylib 0x17a68 objc_exception_throw 2 ShazamKit 0x159d0 -[SHMutableSignature appendBuffer:atTime:error:] 3 ShazamKit 0x6d7c -[SHSignatureGenerator appendBuffer:atTime:error:] 4 ShazamKit 0x3968 -[SHSessionDriverSignatureSlot appendBuffer:atTime:error:] 5 ShazamKit 0x10430 -[SHSignatureBuffer flow:time:] 6 ShazamKit 0x2490 -[SHStreamingSessionDriver flow:time:] 7 ShazamKit 0xf784 -[SHSession matchStreamingBuffer:atTime:] 8 MyApp 0x17f69c thunk for @escaping @callee_guaranteed (@guaranteed AVAudioPCMBuffer, @guaranteed AVAudioTime) -> () (<compiler-generated>) 9 AVFAudio 0x482ac AVAudioNodeTap::TapMessage::RealtimeMessenger_Perform() 10 AVFAudio 0x71c4 CADeprecated::RealtimeMessenger::_PerformPendingMessages() 11 AVFAudio 0x471e4 invocation function for block in CADeprecated::RealtimeMessenger::RealtimeMessenger(applesauce::dispatch::v1::queue) I don't mind failing if the format is not good, but how can I avoid crashing?
3
0
768
Jun ’23
MusicKit subscription page crashes
Hi there, It seems I'm getting crashes in the Apple Music subscription view sometimes. Couldn't figure out why. crash_info_entry_0 _MusicKit_SwiftUI/MusicSubscriptionOffer.swift:73: Fatal error: Unexpectedly changed musicSubscriptionOffer's isPresented binding to true while internal presentation state is loading(MusicSubscriptionOffer.Options(messageIdentifier: .join, itemID: 331661274, affiliateToken: ....)). It's important to note I am displaying it from UIKit ObjC and so I had to go through some hoops in order to get this to working. Here's the relevant code: // // MusicSubscriptionOfferView.swift // import Foundation import MusicKit import Combine import SwiftUI struct MusicSubscriptionOfferView: View { @StateObject var viewModel = MusicSubscriptionOfferViewModel() var body: some View { EmptyView() .musicSubscriptionOffer( isPresented: $viewModel.isShowingOffer, options: viewModel.offerOptions ) } } class MusicSubscriptionOfferViewModel: NSObject, ObservableObject { @Published var isShowingOffer = false static var musicItemID: MusicItemID? var canBecomeSubscriber = false var offerOptions: MusicSubscriptionOffer.Options { get { var options = MusicSubscriptionOffer.Options() options.affiliateToken = "..." options.itemID = MusicSubscriptionOfferViewModel.musicItemID return options } } var subscriptions = Set<AnyCancellable>() override init() { super.init() Task { for await subscription in MusicSubscription.subscriptionUpdates { MyApp.sharedInstance().canBecomeSubscriber = subscription.canBecomeSubscriber } } NotificationCenter.default .publisher(for: NSNotification.Name(K_SHOW_APPLE_MUSIC_SUBSCRIPTION)) .sink { [weak self] _ in self!.isShowingOffer = true } .store(in: &subscriptions) } } MusicSubscriptionOfferViewModel is initiated on launch, so MyApp.sharedInstance().canBecomeSubscriber receives a value upon launch. and: @objcMembers final class MusicOfferProxyViewController: UIHostingController<MusicSubscriptionOfferView> { required init() { super.init(rootView: MusicSubscriptionOfferView()) } @objc required dynamic init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } } From the UIKit view controller: MusicKitInterop* musicKitObject = [[MusicKitInterop alloc] init]; [self.view addSubview:musicKitObject.musicOfferProxyViewController.view]; [self addChildViewController:musicKitObject.musicOfferProxyViewController]; self.musicKitInterop = musicKitObject; class MusicKitInterop: NSObject { var musicOfferVC: MusicOfferProxyViewController override init() { musicOfferVC = MusicOfferProxyViewController() } @objc func musicOfferProxyViewController() -> UIViewController { return musicOfferVC } @objc func canBecomeSubscriber() -> Bool { return MyApp.sharedInstance().canBecomeSubscriber } }
1
0
539
Sep ’23
PermissionDenied to documents folder
Hi, I am having this rare issues, where a handful of my users are crashing when trying to access their realm file. This is the error I'm seeing: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=io.realm Code=3 "Failed to open file at path '/var/mobile/Containers/Data/Application/BCA5E4BC-5923-4D7E-8142-AB49B32A7E59/Documents/default.realm.lock': Operation not permitted" UserInfo={Error Code=3, NSFilePath=/var/mobile/Containers/Data/Application/BCA5E4BC-5923-4D7E-8142-AB49B32A7E59/Documents/default.realm.lock, Error Name=PermissionDenied, NSLocalizedDescription=Failed to open file at path '/var/mobile/Containers/Data/Application/BCA5E4BC-5923-4D7E-8142-AB49B32A7E59/Documents/default.realm.lock': Operation not permitted} and I can report that for all for those users, it seems that identiferForVendor has returned nil. So it looks like that's the common denominator. Any idea on what other data I can log or what's the issue here? Thanks..!
1
0
365
Apr ’24
empty dSYM file detected - Xcode 16
Hi, I recently updated to Xcode 16. Since then I successfully built my app and sent an update to the App Store. But suddenly, after an exception I've experienced while working on my code, the app is crashing on launch, without showing the stack trace, and showing only one warning in the console: warning: (arm64) /Users/myuser/Library/Developer/Xcode/DerivedData/myapp-bglvscamatwthwbfqmtzmbvxeewc/Build/Products/Debug-iphonesimulator/myapp.app/MyApp empty dSYM file detected, dSYM was created with an executable with no debug info. Tried deleting derived data Erasing all simulator data Reseting my computer No change yet. Any idea what am I missing? Thank you..
17
20
8k
Sep ’24