Post

Replies

Boosts

Views

Activity

Should one use NWListener? POSIX Address already in use
Let's say you want to stop a server. https://developer.apple.com/forums/thread/75997 From searching apparently, there's an automatic cooldown. Don't know whether it's true or not. That thread mentions socket variables, that I don't believe can be used with the NW stuff. NWListener "cancel" doesn't seem to stop a server? Eitherways, doing that and trying to use .start and something like self.listener = try NWListener(using: self.cfg_nwParameters, on: self.port) self.listener?.start(queue: .main) this will trigger Address already in use if you "stopped" a server, because apparently you can't stop a server with NWListener. Because the socket isn't actually closing apparently.
15
0
341
Oct ’24
Non-XCode crash logging for iOS?
I test my app, by building it and hoping it will go on my iOS. This is the only workflow I have to test my testing app. I use AVAudioEngine and AVAudioSession. It sounds painful but, yes. I literally comment out parts and build the app everytime and see if it would crash or not. Sometimes I'd get Crash Logs in the Analytics part, but I haven't managed to get them there anymore. So I had no more Crash Logs. I was wondering if there's a function or something. Maybe something that I can do in AppDelegate to make it create a Crash Log somewhere? Uncaught Exception overwrite, didn't solve the issue for me. It really has to be an actual crash log, something that catches these. If someone knows, let me know! Thanks
1
0
245
Sep ’24
I don't know how I can test my Testing App on my iPhone anymore
I am new. I have never used Swift nor XCode or the CLI. But I have found and managed to test my App that I created for testing on my iPhone. I have absolutely no intentions to put it on the App Store. I even made it Open-Source on GitHub. I learned a lot of things and ways to prevent crashes, but unfortunately I am slowly starting to lose the ability to put my App on my iOS. I am new here as a developer. But I have troubles to create a Developer Account, so I am not sure what I should do. Here's what I think I am having issues with: I feel like you can only create a Developer Account if you have a business, is this true? I really find it cool to test my own App on my own phone. But I want to do it in an official way. But I don't know how. Others have told me that you'd need a License for the App Store. But I am not trying to put it on the App Store, will this make it impossible for me to test my own app? Why make an app if not putting it on the App Store? You can learn. If you make good Apps or Libraries, you can provide them to other Developers! Maybe even an opportunity to collab with someone and even indeed put it on the App Store with a valid Developer Account. Seriously, if I wouldn't have been able to test my iOS app through other ways on my iPhone, I'd have never been able to make a short breakdown about AVAudioEngine and AVAudioSession. I've seen people that have run into these crashes. I tried to look up for a fix, but found none. I saw apps that allowed you to use a Microphone on a Laptop/PC and I decided to make my own one to test, and succeded, while I yet need to figure out a few crashes, I managed to do it, and I really want to continue and actually use my own App... So I was really happy that I could make a post to provide a guide in hopes that it would help someone. And I would do more, but I really need help with figuring out how I can test my own app on my own phone. I hope that Developer Relations can help with this.
4
0
284
Sep ’24
Short small starter guide for AVAudioEngine and AVAudioSession on iOS
AVAudioEngine and AVAudioSession Welcome! I will start off with the terms AVAudioEngineImpl::Initialize(NSError**). Why? I want to make those who run into this issue have to possibility to find this post through Search Engines! This is short small breakdown based on what I observed while trying to use these two Components. It's not a guide that goes into all the details. If you're trying to figure out how to fix a crash, you may can find a common way to fix it, in this post! Is it possible to use AVAudioEngine and AVAudioSession together? The answer is yes. But you will face challenges regarding it. Mostly AVAudioEngine. Whatever you're trying to do, it will take a lot of testing. I don't know how it will be with an IDE. But with just .app and iPhone it will take some testing. Or a lot of testing. Something that helped me fixing a crash was, this here: https://developer.apple.com/documentation/avfaudio/audio_engine/audio_units/using_voice_processing This example Project by Apple, uses both AVAudioEngine and AVAudioSession. How can I fix AVAudioEngineImpl::Initialize(NSError**) ? I think this depends. If you're lucky and have a crash log, you may can find clues, but the stack trace sometimes doesn't really help either. I will mention common cases that I encountered though. inputNode https://developer.apple.com/documentation/avfaudio/avaudioengine/1386063-inputnode You need an inputNode apparently. You need to access it or else I think there won't be one. And if there isn't one, AVAudioEngine.start will most likely crash. The audio engine creates a singleton on demand when first accessing this variable. Doing this has prevented this common issue for me. .prepare deallocates and can cause a crash if you restart your AudioEngine Another issue I faced was handling .prepare wrong. You don't need .prepare. But if you use installTap or other things, I think you need it. Here is a common thing to note. If you had previous initialized inputNode. Those could be gone after using .prepare. You have to ensure you're accessing AVAudioEngine.inputNode again before calling .start() or whatever node you need. The Voice Processing Project, does this by creating a Managing Controller for AVAudioEngine with a sort of "setup" function, which ensures that everything is ready, before .prepare and .start get called. AVAudioSession's setCategory You have to experiment with it. The crashes can be very weird. Sometimes your App will only crash once, and then only after you install it again, or if you start it up. You are actually able to use .setActive and .setCategory with AVAduioEngine. Just do not try to do .setActive(false) before you've stopped the AudioEngine, as it will fail. Sometimes I'd run into an issue with .setActive(true) so you really have to experiment if leaving that part out resolves the issue or not. try session.setCategory(.multiRoute, mode: .default, options: [.defaultToSpeaker, .mixWithOthers]) Experiment with it. But these .multiRoute and .mixWithOthers have allowed me to use AVAudioEngine to make a test recording. And I can even switch the Data Sources and Polar Patterns without any issues. Sometimes you can get away without setting .setActive at all. Not sure if AVAudioEngine does it automatically. Short Summary If you use .prepare and then .stop, make sure to initialize things like .inputNode before calling .prepare and .start again. (THIS CAN BE DIFFERENT) Only call .setActive(false) after you used .stop. Otherwise I believe it has no chance to stop it. AVAudioSession setCategory is important. Ensure you use mixRoutes or experiment with all the modes. If you manage to solve your crash, you'll be able to indeed change the Data Sources and Polar Patterns and more! Use isRunning before using .start, this will save you from another crash. If you use .start while it's already running, I think try and catch won't save you here, you have to ensure you're not starting it twice. I hope that this short breakdown will help you to resolve your crash. If you get deeper into AVAudioEngine and AVAudioSession, you'll probably face more crashes. I yet, need to figure out how to solve them. I have a lot of trouble to put my Testing App on my iPhone, so I am sorry if this guide didn't cover every detail of it. A HUGE tip from me is to check the Documentations. As example, when I read the Documentation for inputNode I learned why my app crashed, it's because I never accessed and initialized one. The Developer Documentation can be a little bit of a laberynth, and I strongly recommend you to read every property you try to access if you believe they cause issues. And I also recommend to find example Projects like the Voice Processing ones. As there aren't any Code Examples in the Documentation.
0
0
311
Sep ’24