EXC_BAD_ACCESS thrown if files are edited, must be committed before running - iphone

I get EXC_BAD_ACCESS from starting my program, sometimes if I edit the files. It never used to do this until recently when I removed a PNG/PLIST file from the resource folder (by deleting it). But I did replace it with the same name.
After that whenever I changed my code I get the EXC_BAD_ACCESS thrown as soon as it gets to the point where it loads those files. (App Delegate out of scope).
However after committing the files via local source control I'm able to run it again without getting the EXC_BAD_ACCESS. As soon as I edit something else and not commit it, it throws it to me again. I think I mucked up my source control/versioning by deleting that resource file.
Got any ideas?

Solved the problem. I was going to post the code but it'll be hard to decipher since it spans a few classes.
I used Zombie to help me locate the culprit and turns out I was over-releasing one of my dictionary objects. It had nothing to do with those resources (which cleaning fixed), I must've added an extra release while editing the code (prior to cleaning).
A clean build fixed the problem where if I added (even just a comment) to one of my classes it would break the build unless I commit the changes. Thanks Deepak, hopefully this will help someone else out there :).
P.S. sorry for the slow update, I've been quite busy.

Related

Unity erased all my progress on my project back to original state

I started a new project and after closing and reopening it the next day, all progress was gone. It didn't crash and there weren't any abnormalities. I didn't touch any files in file explorer so it's not like I could've reverted the project or something. And yes I saved, I always save. Recycling bin is empty so it wasn't deleted. So I haven't much idea what the cause could've been, or what else to put really.
But is there any explanation for what could have caused this so next time in the future I can prepare for all my progress being erased out of the blue. And is there any way I can retrieve the files back somehow too?
Using version 2020.3.2f1
Have you tried looking through temp files? Because I had this problem too a while ago and was able to retrieve the data which was hidden in the files somewhere. I had a backup and it didn't help because it didn't save to the backup obviously. I don't know why Unity still has this problem and there's not a lot of help on the internet regarding it either

hot swapped warning without making any changes (Spring tool suite 3.9)

When running my code in debug mode, I keep getting 2 error messages:
Could not delete [path_to]\productiondb.log. May be locked by another process
I don't know what process might be locking it. It comes when I make changes to the code while my Pivotal tc Server is running in debug mode, but it dosent seem to create a lot's of trouble. Sometimes however, I get this warning:
Also due to some changes. I usally just restart the server and move on. This isen't the real problem, the real problem is that I get these messages when I havent doen any changes. Somethimes it accures when I run a certen part of the code, other times i occurs when I open certen codes in sts, however, it doen't seem to stop at the same place twice.
I am suspecting that this has something to do with git. I am using git to change between versions and doing tests. So I am thinking that STS has some of the code in memory from before I changed branche with git, and isen't updating it before I run or open the file with that code. But I am rather new to both sts and git, and can't be certan that it would work that way. If it is, does anyone know how to update sts after I have changed branch? If it is not, does anyone know what might causing it?
If you run an app in debug mode, the Eclipse Debugger tells the application when code gets changed and tries to use the debug API to swap in the new code into the running application. This is especially useful if you debug your code, hit a breakpoint, step through the code, fit the issue, change the code, and press save. At that moment, the Eclipse compiler updates the class file and tells the running JVM to swap in the new code. If that succeeds, the debugger will jump back to the last stack frame and the execution of your app will continue with the beginning of the method that you entered. This allows you to directly continue to debug and step through the updated code without restarting the app.
While this is a great feature of the JVM, it is very limited in terms of what scope of changes to the classes the JVM can deal with while doing this hot-swap. It is usually limited to method implementations. So adding new methods, adding or deleting members of the class, etc, are not supported. As a result, the above screenshot will appear. It means that the JVM wasn't able to hot-swap the changed code and will continue to run with the previously loaded code instead of the changed one.

Xcode is marking all symbols as 'undeclared type' yet they are visible and the project compiles fine

Just to get some context here is a screenshot, though you probably gathered this from the title:
Xcode is marking all symbols as undeclared, usually this would be because it doesn't exist or isn't imported, but in this case it was working fine 20 minutes ago and weirdly the project compiles and runs with no problems.
When I compile the errors go away but there is no syntax highlighting, as soon as I start to edit the file the errors all come back. I can work if I remember the exact signatures for anything that I need to use but with the lack of code completion and errors this is very hard.
Notably this is only a problem in a few source files, its not even the whole project. Nothing has changed that I am aware of that could cause this.
Before anyone suggests it, I have tried cleaning, deleting derived data/build folder, restarting Xcode etc...
My colleague is seeing the exact same issue on his machine.
So I managed to fix the offending source files, I just compared their attributes to those of a working source file and it turns out that the problem files included the tests project in their target membership and the working file did not. I'm not sure why this is causing the issue as other projects use automated testing without a problem. Nonetheless this solved it for me, at least until I start writing test cases...

How can I remove deleted files from emacs-projectile's cache if `projectile-invalidate-cache` doesn't do the trick?

Pretty much what the title says. For whatever reason projectile-invalidate-cache does not remove dead files from projectile's cache, or at least not from the results it presents me. I am using Spacemacs, an extension of Emacs, but I believe this issue is specific to projectile.
Restarting the editor does not fix the issue.
One thing to try would be to make sure you are running projectile-invalidate-cache from the project you want to clear out files for (i.e., from a buffer that is visiting a file in that project. From the docs for projectile-invalidate-cache:
Remove the current project's files from `projectile-projects-cache'.
Note it is supposed to work only for the "current project".
However, I have also not had much luck with this command (potentially this is me not using the command correctly). What I often end up doing is deleting the actual cache file (in my case this is ~/.emacs.d/projectile.cache. I have not noticed any negative effects of this, and your cache will be rebuilt without the deleted files next time you use projectile.
If your project is a git project, try to commit your change. It works for me.
Actually the correct path of projectile.cache file to be removed is: ~/.emacs.d/.cache/projectile.cache
I installed through MELPA, and deleting ~/.emacs.d/projectile-bookmarks.eld did the trick for me.

Xcode "Use of undeclared identifier" errors, compiles/runs just fine

I've got an incredibly annoying issue that is hampering my workflow. In my project I have "User of undeclared identifier" errors all over. They are all in reference to a single class, specifically a Theme class. I checked for any circular referencing with my imports, none. I'm really confused.
Here is a screenshot of the errors. I would post errors in the Build Log for more detail, but there aren't any. It builds and runs just fine...
I've tried cleaning, deleting the derived data... Any ideas?
I was having the same problem and noticed that all of the undeclared identifiers were declared in files that were in my pch file.
With this in mind I deleted one of the #import lines from the pch file and recompiled which failed as expected. I then put the deleted line back in, recompiled and it compiled normally with all the false errors gone.
Hopefully this simple solution helps a few of you out if the above solutions don't.
These kinds of errors are quite common with Xcode, unfortunately. It would be great if it would auto-refresh its error list all the time, but it doesn't always. When this happens, I strongly suggest that you restart Xcode, which will flush its error cache and hopefully solve your issues.
How are you including this class? In most cases I just include the class explicitly in header and/or body - instead of the *.pch file. Then this error goes away in my case.
Also deleting the derived data workes once in a while. Did you change the location in preferences recently by any chance. I also got this error when I use a ramdisk for derived data and then go back to default. This is the most annoying case - since it causes this error to appear then in almost every file.
This error seems to happen more often in Xcode 4.4 than the prior versions.
Have you included the library files correctly? Take a look at that. Sometimes ARC issues might occur if we don't include the correct file, or something's missing or not connecting UI.
For me the issue was that I created UnityInterface.h/m file to handle the obj-c to c# interface. UnityInterface.h is already defined by Unity. I renamed my own UnityInterface to _UnityInterface and now everything works.
Just posting this for anyone who might have this problem later and doesn't find any of these solutions to work:
If you have any pragma marked #if statements that only execute if the program is in debug mode it will obviously cause anything declared inside of them to not be declared when you try to archive/export.
I had the same problem. Closing and opening XCode didn't help.
I solved it by checking errors in other targets and fixing them (I had tons of errors in my unit testing target). Also I moved header links from h files to m files. But I'm pretty sure, that the first thing was critical.
For others who experienced the same problem and tried all solution above with no result, perhaps you should try something like I did. I solved the problem simply by unplugging my iPhone USB cable from my Mac and then replugged again those cable. After that, rebuilt again and all undeclared identifier errors were gone.
I had the same error. In my case, it was on this line of code:
- (void)playerItemDidReachEnd:(NSNotification *)notification {
// some code
}
My error message said:
Use of undeclared identifier 'playerItemDidReachEnd'
I tried added this line to the .h file:
- (void)playerItemDidReachEnd:(NSNotification *)notification;
I cleaned it, I re-booted my macbook, and I was still getting the error.
Finally, I decided to try to delete the line in the .h file. I then pasted it into a text file, and then copied and pasted it back in to the .h file.
Now I cleaned and VOILA' !!! no more errors. Go figure. This happens sometimes in VBA. Somehow there seems to be unseen formatting in a line of code. So I thought it might be happening with xCode. Cutting it out, pasting into a text file, cutting out of the text file, and pasting it back in right where it was - fixed it in my case.
---- UPDATE -----
The above was posted as my answer. Apologies, apparently there's something else wrong.
After cleaning - my ERRORS were gone. Now I tried to build and run my app. THE ERRORS CAME BACK! So this time I re-created the class files after cutting out all the text, and pasting it into a text file. I did it for both my .m and .h files. But now the errors are back again after trying to run. SORRY. I don't know how to delete this text altogether cuz it is not an answer.
Tried to build and run my app. THE ERRORS CAME BACK!
There was also an error msg that I was missing a bracket ( } ). Finally I looking at the method just before this method, and sure enought it was missing the ending bracket! That was it!
Might be little late in answering.
I had this issue very recently. I fix this by updating my OS and then updating Xcode. I tried updating Xcode alone but did not happen because Xcode 9.4 requires OS High Sierra 10.13.*
Happy Updating :)
It it compile time error
Use of undeclared identifier '<class_name>'
I was run into this issue when developing own framework and app. Objective-C consumer -> Objective-C static framework
Report Navigator had a clear description
umbrella header for module '<module_name>' does not include header '<class_name>.h'
The solution was just to add #import <class_name>.h into umbrella header in a framework target
Try to click Product -> Analyze, after that to Product -> Build. This helped for me.