I'm migrating my project from AudioKit 4 to AudioKit 5 and currently stuck on a bad access error. The variables look like they are passed correctly into the SynthVoiceStart method. I'm quite stumped why it's throwing the error as it should be a simple change from AKOScillatorBank to the Synth object.
The project code is accessible HERE on GitHub.
I've attached a screenshot below.
XCode Error
Thank you, a simple mistake on my part.
let engine = AudioEngine()
Was accidentally inside the 'init' method and was not declared beforehand. This meant that AudioKit did not start correctly.
The corrected code is below.
XCode Correct Structure
This is more of a comment, but I don't have enough reputation.
In the past I've investigated and managed to solve EXC_BAD_ACCESS errors with AudioKit by using Address Sanitizer (ASan). In XCode go to Edit Scheme, Diagnostics tab, and tick the Address Sanitizer option. When your program is recompiled and run, ASan will print a report whenever a memory error occurs. This sometimes gives useful information to resolve the error.
Related
I have recently updated to macOS 13.0 and for that minimum XCode Version required is 14.x series. But my existing project never getting successfully building. Its getting stuck at some point.
Its not getting failed. Build process screenshot is attached below. Its not pointing to any specific class. Seems like there are lots of classes which are getting compiled successfully at last but still build process is stuck at some point:
Seen similar threads like below on apple pages but nothing seems working. Does anyone got resolution?
Xcode 14 project compile error
XCode 14 compile errors immediately disappear or do not appear at all
Something similar has happened to me in the past on a number of occasions. If the Swift compiler is hanging mid-build, usually the issue is that there is some expression that is too complex for Swift to do the type inference on.
What you need to do is first find the exact statement that is causing the hang. This is how I do it:
First find out which source file is causing the problem. Look at the build log to figure this out (the build log can be located by looking at the reports navigator ⌘9 ). Find the build log and click on it. The build log will appear in an editor window.
One of the compiles will still be in progress and its file is the one you want.
The next thing to do is comment out all the code and recompile. This time the compilation will finish (if you have the right file, or there is only one) but probably with a lot of errors. Then you add the code back in, function by function, until one of them causes the compilation to hang again. If it's not obvious which line of the function is causing the problem, comment it out again and then add the lines back one by one until the compilation breaks again.
Once you have located the line, you need to simplify the type inference on that line. If it's a closure, try adding an explicit declaration for its parameters and return type. If it involves some complex array, try adding a type annotation to its declaration. Also try breaking down complex expressions into multiple simpler expressions.
There's no one size fits all answer to this but usually, once you have located the exact line that is causing the problem, it should be reasonably obvious how to fix it.
My code is unable to build on xcode 7. What is Segmentation fault?
A segmentation fault happens when your code tries to access memory that it isn't allowed to access. This is often a sign of an uninitialized reference.
It's not clear to me from your screenshot exactly what is going on, though. Perhaps you could provide more details?
From the screenshot it looks like it is happening when you build your project. If this is correct, you need to create a minimal example that displays the problem i.e a code fragment that crashes the compiler in the same way and then you need to raise a bug report about it with Apple (supplying your minimal example so they can reproduce it).
This has happened to me a couple of times in the past and the way I have identified the bit that crashes the compiler is to comment out everything in the source file and then add it back in function by function.That will narrow the problem down to the function. After that you repeat with the lines of code in the offending function, until you get the line that crashes the compiler.
Along the way you may find a work around to stop the compiler crashing. If you do, do not be tempted to skip reporting the bug to Apple. They need to know.
I was trying to make a simple app for sudoku solving on GPU with iOS Metal Framework.
I was following instructions from this blog post:
http://memkite.com/blog/2014/12/15/data-parallel-programming-with-metal-and-swift-for-iphoneipad-gpu/
I version my code here:
https://github.com/mateuszbuda/Sudoku
(As of writing this question HEAD is commit c3e06e0)
And I've encountered error when calling
newComputePipelineStateWithFunction
that is while setting up MTLDevice in ViewController (line 95):
https://github.com/mateuszbuda/Sudoku/blob/c3e06e0e1edc724eea20962f32e49f0df8143b7d/Sudoku/ViewController.swift
The error I get is:
Error Domain=AGXMetal Code=1 "Compiler encountered an internal error"
I'm running this on iPhone 6 Plus with iOS 8.1.3
Have someone any idea what can cause the error I get?
You are experiencing one of the unfinished matters in Metal. The reason the error says "internal" is because this is a compiler error, CAUSED by the compiler. Not you. Try this:
Copy all of the code in the ".metal" file that is not compilable.
Delete the .metal file (NOT just the reference).
Remove all of the content of the "DerivedData" folder located at users/yourUser/Library/Developer/Xcode/DerivedData
Create a new .metal file and paste the old code in this new metal file.
Now build and run, you should be good to go.
Anybody who finds this error make sure to send some sort of error report to Apple so that they can properly debug it and fix it in the next release of Xcode.
For anyone having the same problem, I've figured it out.
It just means that there is something wrong with a kernel function. Most probably it doesn't compile, even if you don't see any errors in Xcode.
I receive this error when appending an already-successful build in XCode. What I don't understand is I'm not changing anything when appending, and this error shows up.
I've never used an 'old version of Xcode' as the error implicitly states.
Does anyone know how to get append working on a consistent basis?
This is a very simple project, and I'm using Playhaven and TapForTap SDK's, if that offers any insight.
Turns out, XCode upgraded itself without telling me. :(
I rolled back to the version I was using and all is well.
With no code snippets or error logs, it's very hard to determine what the source of your problem is. There's no way to know if your error is describing the cause of your problem or a symptom of the problem without more information.
I can only offer some suggestions:
My first thought is that you're using a deprecated method in your code somewhere, possibly "Append", which if that is the case, more than likely has an updated counterpart, but you'll have to check documentation regarding that.
If you've used "Append" previously with no errors, then you should look into what exactly you've changed in your new build, and verify that the methods you're using are supported.
If your errors are vague or unhelpful, you can begin the process of elimination and start commenting out blocks of code until it builds successfully, and narrow down the source of the problem significantly.
However, it would be to your benefit to expand your question with more information.
It used to work fine but now I get this message when loading a certain scene and then the APP crashes.
2012-12-01 18:33:55.104 AppName[9561:707] cocos2d: CCSpriteFrameCache: Trying to use file 'art1-hd.png' as texture
I have no idea on where to start debugging this. Is there a way to get a more precise error message to understand why this happens?
Btw, I have changed my code signing identity to developer and XCode doesn't yet give me any trace of it on the console other than the plain message above. I checked as well the device logs on the Xcode-Organizer section but no trace.
I whish there was something like in Java + Eclipse, where I could get a precise STACKTRACE of where the crash happened.
Any suggestion on how to get a precise stacktrace (E.g. with function name generating the crash)?
PS: I have set strip debug symbols to "NO" in DEBUG, and to "YES" in Release, but I am builing on my own test iPod and hence I think it is automatically build for "Debug" (the section says build for running and testing which is confusing as the project settings allows only debug and release). But I think the problem is not here.. but in the issues above before the PS:
EDIT: If I look into the debug navigator I don't see any stacktrace of methods, as I want, but just threads.. I need to figure out how to use the global exceptions.
I have no idea on where to start debugging this.
You have the cocos2d source code. I would start there.
Search for "trying to use file" in CCSpriteFrameCache to understand what the cause of this message is (which I agree is confusing, why shouldn't you use that file?).
As for the stack trace, it's available as soon as you add a global exception breakpoint. If the breakpoint triggers in OpenAL code make sure to set it to catch only Objective-C exceptions.