Can't run the project cause of the EXC_BAD_ACCESS - swift

I am working on a project and I have no professional experience on iOS development. Any way after I update my Xcode 11.0 (now it's 11.1) I can't run the project in any way. But if I try to open my 1 year old project it's open without any problem. I got all the time Thread 1: EXC_BAD_ACCESS (code=2, address=0x7ffee4ac0e98) and interesting part is error itself does not show up same spot. If I delete or modify the faulty field it just pop up completely different line. I want to show code but it does not occur in a specific place.
But error generally pops up the one of my third party code. I used MyThirdPartyTextFieldAnimationFiles and here I used IsaoTextField.swift and TextFieldEffects.swift. In TextFieldEffect.swift file declaration public let placeholderLabel = UILabel() gives the error first. I don't understand where the error originated from. Thanks for helping any way.
Kind Regards.

I solve the problem but this solution won't be the right one. Error itself is so generic error type every can cause this. I explain my solution if one of you get that error he/she can use that maybe anyway.
In my app I have a NavigationController and one of my view(it is one of the views in the that NavVC) I declare the next VC at the start of the class and than push it to the top of the NavigationController. The error is cause by that declaration position. I moved it in the button function and error disappear.
Less buggy and nice days all.

Related

How to solve a Thread 1: signal SIGABRT error? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I'm having an issue with my app, it keeps coming up with a Thread 1: signal SIGABRT error every time I build it. I've looked for a solution but nothing seems to work, any ideas? I'm new to this!
Error In consolse
What Does “Thread 1: Signal SIGABRT” Mean?
The error SIGABRT stands for “signal abort”. It’s a signal that’s sent by iOS to a running app, that immediately quits the app because of a runtime error. It essentially means your app has crashed…
there might be possible causes
Check Your Outlets:
You created a new view controller in Interface Builder, and set it up
with a few UI elements like buttons and labels
You connected these UI
elements to your code by using outlet properties, which creates a
connection between a property of your view controller and the UI
element in Interface Builder
At one point you changed the name of the
initial outlet property and your app started crashing with a SIGABRT
error
Check The Stacktrace
if Xcode won’t show you any helpful error messages for a SIGABRT crash, try typing commands in the console area to debug such as help and bt:
bt is very useful to see the current call stack (also called “backtrace” or “stacktrace”).
Make An Exception Breakpoint
Here’s how you can set an exception breakpoint:
Go to the Breakpoint navigator in Xcode, by using the tabs on the left
Click on the bottom-left +-button and choose Exception Breakpoint
Leave the default settings as-is (although they’re helpful to customize)
Run your code
When an exception is thrown, execution of your app halts. You can now use the debugger to inspect values, step through the code, and use LLDB commands. When possible, Xcode will take you to the line of code that caused the exception.
Looks like you don't have a prototype cell in your collection view. This article might help you work through the issue.
https://theswiftdev.com/2018/04/17/ultimate-uicollectionview-guide-with-ios-examples-written-in-swift/
Without looking at the code I'm guessing you should be able to go into the storyboard select the cell and add in the cell name using the inspector on the right.

Error or it does not execute BWWalkthrough

So I have followed your tutorial step by step. Still having issues...
I have installed it first with CocoaPods and seems that others are having the same issue.
If I name the custom class module (top right on the identity inspector) BWWalkthrough it will crash with the following line
let walkthrough = stb.instantiateViewControllerWithIdentifier("onboardingZero") as! BWWalkthroughViewController
Could not cast value of type 'BWWalkthrough.BWWalkthroughViewController' (0x1054e6b50) to 'NameOfMyProject.BWWalkthroughViewController'
If I change the custom class module to NameOfMyProject (or leave it blank) it does not crash and the initial View Controller loads fine, when I tap the first button it simply does not load step0, the code executes fine, but nothing happens and I never get to see the first BWWalkthroughViewController.
I have tried with both cocoaPods and by copying the files. Spent a good two hours looking at this and got nowhere. Please help!!!!!

Thread 1 : EXC_BAD_ACCESS (Code = 1, address = 0x30000008) issue generated

I have an issue running an app on a simulator.
The problem:
EXC_BAD_ACCESS occurring at objc_msgSend in Thread 1.
Screenshot :
In my Application, I have multiple ViewController. when I click on back button of UINavigationBar then this type of issue is generated, I can't explain my problem because all the functionality works properly.
Example :-
1 - fitstVController (work properly)
=> it have UITableView, when I click on specific row then it will go on another UIViewController (SecoundViewController)
2 - SecoundViewController (work properly)
=> it have UITableView and UIActionSheet. when I select button of UiActionSheet then another UIViewController (ThirdViewController) is open
3 - ThirdViewController (work properly)
=> it have UITableView and multiple UIPickerView. But HERE IS PROBLEM THAT I CAN'T GO BACK AT PREVIOUS UIViewController (SecoundViewController).
=> when i do that then EXC_BAD_ACCESS (Code = 1, address = 0x30000008) issue generated.
In short, this type of problem occurs when you release the memory assigned to an object that has been already released. Most likely, this type of issue is generated when you go back to your previous UIViewController (or other cases).
And also, I suggest reading the following link for a more thorough explanation:
Hamster Emporium archive:So you crashed in objc_msgSend()
Setting an exception breakpoint means that Xcode will stop execution as soon as an exception is raised. It's not entirely foolproof, but this will usually result in the app breaking on the line of code that caused the problem.
That makes it a LOT easier to track down the source of the problem - although the stack trace is the definitive way of diagnosing issues, it's often far too detailed to be of much use (especially if like me you're not a compiler expert.)
To set this up, click on the Breakpoints symbol in the Navigator panel and click the + button at the bottom. Then select Add Exception Breakpoint, and Objective-C from the List of choices.
As #TimD has rightly pointed out, you can set an exception breakpoint and it will highlight the offending line of code (rather than trying to decipher the assembler or manually trying to identify where the problem is). And, as always, when diagnosing these sorts of memory issues, you should always enable zombies. Finally, especially important in non-ARC code, you should run your code through the static analyzer as many memory related problems can be identified there. You should always make sure you have zero warnings from the static analyzer as it invariably points out critical programming errors.

iPhone App Crashes on button click

I made my project in storyboard in, due to issue with the custom UITableViewCell I have made a new project, copied all of the data to my new classes and copied my buttons, images etc from the storyboard views to new project's nib/xib files.
Now When I click on any button my app crashes without any error and it opens delegate file and highlights this line of code
return UIApplicationMain(argc, argv, nil, NSStringFromClass([ThisOrThatAppDelegate class]));
I have already made connections for the required actions from IB to controller. Also I have tried Command+Shift+K for clean code. But the problem is still there.
You have to find out first what the problem is:
use the Debug build config and are using lldb or gdb
make sure you have a breakpoint on all exceptions
make sure you have the "Breakpoints" button top left enabled.
run the app
You should break into the debugger. You need to get to a point where the debugger catches the exception.
Then edit your question and tell us what exception you get. I'm going to guess you'll be getting a objc_msgSend() error, which means that some object is trying to message a non-existent or dealloced object. If that turns out to be true, then you can enable "Zombies" (which lets all objects stay around) and see if one of those gets messaged.
If nothing seems to help, then what you need to do is start adding NSLog messages to track your app as it comes up (or use breakpoints, your choice). This takes a long time so you might work backwards - see if your appDelegate application:didFinishLaunchingWithOptions: gets called, and also if you get to the end of it.
Unforunately this type of problem can be take a lot of time to track down. Some object has probably queued a message up for another object on the main queue, so when you get the crash you don't get to see who did what when.
Also, with objc_msgSend problems, when the debugger stops you cannot easily see what object was messaged - but if you turn off the debugger and let the app actually crash, you can find the crash report in the Console app and get more info from that.

App crashes with no exception or crash log

My app crashes, but generates no exception in the console and no crash log on the device. No memory warnings are received. Is there any way I can narrow down the cause without having to comment out code?
Stepping through the code should help you nail down where the app is crashing, this will stop the program execution before it hits any "bad" code (providing you put the breakpoint - where the code will stop in the right place). You can add a break point by clicking on the appropriate line number to the left of the code editing pane and can access the break points organiser through the View->Navigators->Show Breakpoint Navigators menu.
You may have some inkling of the method or class that's currently being executed in which case you should put a break point on the first line of that method, if the class is a UIViewController then putting the break point on the first line of it's -(void)viewDidLoad method may help. You could, at a push, put your breakpoint on the first line of -(void)applicationDidFinishLaunching in the application delegate. However this will require a lot of stepping into instructions rather than just stepping over instructions.
https://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/Debugging/Debugging.html
Apple also suggest turning on the static analyser and then inferring problems in your code from it's output.
The reason for the crash was that I was logging a really large array with NSLog - did not know that could crash an app!