I receive the strangest error: whenever I press and hold a UIButton on my UIView (literally taken from the Storyboard IB and placed onto the screen with no additional edits whatsoever) I receive this error -[NSPlaceholderString initWithFormat:locale:arguments:]: nil argument'
Has this happened to any of you before?
p.s. it also only happens on this particular viewcontroller...
additional note: this ONLY happens when I press and hold the button. I can't for the life of me replicate the error anyway else...
Related
I have a simple UILabel, nothing special about it, in a UIView inside a UIScrollView. I can link it up to my ViewController.swift file just fine, and it doesn't crash on opening, but whenever I try to use the outlet, it produces a nil. I've been looking around for a solution and it seems as though you can't access an outlet inside a subview from the superview... but nothing has been exactly my situation, and none of the provided solutions work.
Here is the full error: Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
The strange thing, though, is that I have another UILabel, seemingly the exact same, that works fine when I try to edit it. I do not know what is going on in the slightest here. How can I fix this?
"right click" no your label in storyboard and check if you don't have another outlet connected, maybe you deleted from code and connection is still there, other than that, you can delete the label from storyboard and recreate connections.
Try providing the #IBOutlet as not weak and try.
This is not the right way, but still let us see if it's working.
My app is crashing on every screen at app delegate where ever I have used label and textfields. When the tags are removed app is working fine but is crashing again when connected to swift file again.
If you have this type of error
STEP 1:Go XIB or if use STORYBOARD go STORYBOARD
STEP 2:Click View Controller
STEP 3:Again Give connection properly(Fill the circle)
STEP 4:Also check whether it is for button action or outlet property
Very Important: Right Click the File's Owner(Yellow Color) and Click on the "Connection Inspector" (upper right arrow), to see all outlets at once. Look for !s which indicates a missing outlet.Remove that. Now it works.
In my app I've a UITableView in which I have custom UITableViewCells and those cells contain UIWebView in which I am displaying YouTube video using <iframe>. When I click on a video and instantly scroll the table before a full screen player opens, the app crashes. I tried Instruments to find the problem and came to know that An Objective-C message was sent to a deallocated 'AAHomeNewsListCell' object (zombie) at address: 0x118e09800.

I'm using ARC and I can't find a way to resolve this issue.
You are sending a message to an object that is no longer alive. The best way to debug that problem would probably be to set a break point as close as you can to where the situation happens, and step through the code. A good place to start would be close to where you use an AAHomeNewsListCell-object, or close to where you trigger the full screen player.
If I had to guess, I'd say that the web view is messaging its delegate but the delegate has already been deallocated. UIWebViewDelegate comes with this handy warning:
Important: Before releasing an instance of UIWebView for which you have set a delegate, you must first set the UIWebView delegate property to nil before disposing of the UIWebView instance. This can be done, for example, in the dealloc method where you dispose of the UIWebView.
Looking at your zombie message, what is it that would be still trying to message the cell? Is your cell acting as the web view's delegate?
Edit Looking at what message is being sent, it gets _setFirstResponder:. It could be a text entry form in the web view that's trying to get first responder to enter text.
I'm new to iOS development, and having trouble identifying the source of a SIGABRT. I've narrowed it down to something that happens during initialization of a UIViewController subclass, specifically between its loadView and viewDidLoad methods.
I narrowed it down with an NSLog call in each of those method overloads in my UIViewController subclass. However, I'm unable to get any more granularity from the debugger; I can't step into the [super loadView] method. Are there any techniques for debugging a SIGABRT other than NSLogs and stepping through with the debugger? Is there any way to see exactly from where the exception was thrown?
Program-specific details
This program uses Core Data; I created it following this tutorial. I believe the SIGABRT started happening after I ran through the "Relationships In Action" section, and was not happening before (I think I had a successful build at the end of the preceding section). Specifically, I can successfully add a Person, but PersonDetailTableViewController throws a SIGABRT between loadView and viewDidLoad.
I've tried deleting the app from the iPhone simulator, and also running a Product > Clean; neither had any effect.
Found the culprit. I had earlier incorrectly created an IBOutlet by ctrl+dragging from a Table View Cell's Text Field into my UITableViewController subclass. I manually deleted the code this created, but a connection remained in the Connections Inspector. Deleting that connection solved the problem -- no more SIGABRT.
It's unfortunate that Xcode sees the problem (see the exclamation mark in the attached image), but didn't tell me about it in any way except the mysterious SIGABRT....
I have a UIButton that is linked to some code that invokes UIPrintInteractionController to print a PDF document.
If I tap the button, the view pops up to let me select a printer and then print the document. However, if I tap outside the view to dismiss the popup, and then quickly tap the "Print" button again, I get the following crash:
[NSConcreteData respondsToSelector:]: message sent to deallocated instance 0xa4696d0
I have debugged with NSZombies enabled, and the crash occurs at this line:
printController.printingItem = dataToPrint;
dataToPrint is instantiated in the same method but prior to this printController line:
NSData *dataToPrint = [NSData dataWithContentsOfFile:pdfFileName];
This crash only occurs if I tap quickly, if I give it a second, everything goes smoothly.
Anyone have any idea what this could be?
Make 'dataToPrint' a strong ivar, and only nil it when you are 100% sure it won't be used again. Most likely the 'printController.printingItem' retains it, but when you dismiss the popup it gets released before the 'Print' button is hit again.