app freezes on deletion of last row in section ios7 - ios

I created an app that used NSManagedDocument and NSFetchedResultsController to populate a NSTableViewController. In ios6 when I deleted the last row of a section it just disappeared and carried on as expected whereas in ios7 the app just freezes and seems to be consuming memory exponentially. I have used the code from the Stanford CS193p lectures to allow the fetchedresultscontroller and tableviewcontroller to combine.
Is this problem a bug in ios7 or does older code need to be updated?
thanks for any answers!

The problem may be that despite deleting the row, the section still exists in memory, try deleting the section using the following method:
[self.table deleteSections:<#(NSIndexSet *)#> withRowAnimation:<#(UITableViewRowAnimation)#>];
Hope this helps!

I found that when I slide the cell to the left to delete it, doing it changes the editing property of the tableview. I had changed the setEditing method to do some custom code for a previous version and so for some reason it kept creating NSIndexPaths. Hope this helps someone in the future!

Related

Getting random crashes while pushing to another view controller

I am getting random crashes while pushing to another view controller.

It was too difficult to find out such a crash, we spent the almost 2-3 days to solve this issue. seems like the crash was due to the one extra view outlet got connected to the main view in the storyboard. Which created the nil reference for some objects of the view controller and applications crashes.
But something surprising to us that how Xcode allowing me to connect the two outlets to the main view. I have again tried connecting the same but this time it is not allowing me to connect.  Attaching the screenshot for the same.

Any kind of help/explanation is appreciated.
Please add crash logs. We should check them. Theres any data moving between two ViewControllers
It is problem with Xcode sometimes while editing the outlets.Find the controller on which app crashes and reconnect the outlets and run again.I don't know the exact reason but that solve my problem.

SDWebImage not setting images in UITableView cells until scroll in Xcode 9.0 beta

I have been using SDWebImage in one of my projects for quite long and accidentally happened to open the project up in the recently released Xcode 9.0 beta. The library was working absolutely fine on the previous versions so I can't help but think it's Xcode that's broken it.
The issue I am facing is that the images in UITableView do not get set when the cells are initially loaded. The images are set only when scrolled out of the view and then back in. I have tried setting placeholder images but to no use. Any help would be very much appreciated. I have been banging my head over this for quite a while now and can't find any solutions.
Use this is in your code when all the data in tableView is loaded successfully
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});
So the answer to this, for now, is -
I was giving my UIImageViews a value relative to its height in the following manner -
cell.userImage.layer.cornerRadius = cell.userImage.frame.size.height / 2;
Changed it to -
cell.userImage.layer.cornerRadius = 25.0f;
And it's working just fine. Not sure where the issue is but I am assuming that it's got something to with the storyboard/constraints in the Xcode 9.0 beta.

iOS 9 Segue Causes App To Freeze (no crash or error thrown)

I have been working on this app for months now and from as far back as I can remember I have never had an issue with segues. The code is unchanged in terms of calling performSegueWithIdentifier but since my recent update to Xcode 7 and iOS 9 I have not been able to tack this issue.
I have tried:
Deleting button and creating new button w/ segue link
Using a direct segue from button to view, without the use of performSegueWithIdentifier
Connecting button to new blank viewController
When I press the button, no initial load functions are called on the destination VC (Ex: ViewDidLoad, ViewWillAppear, etc). When I connect it to a blank view, the segue works fine with the same code in place.
Since the code never stops, or breaks, and just seems to "freeze" in place while still running on Xcode I can't seem to even narrow this down to whats causing the issue. I have a similar segue that is also called from another button on the same ViewController that has no issues whatsoever.
Any thoughts on the matter are greatly appreciated!
EDIT: I have narrowed the issue down to the UITextView's causing the problem. Once the Text Views were removed the page loads fine via segue. I wonder what changed between iOS 8 and iOS 9 in terms of UITextView as I will have to remove the text views and completely re add new text views.
So basically the segue was freezing because of the UITextView's I was using in the destinationViewController. The following fixed the issue:
Delete all UITextView's
Add new UITextView's
you must leave the default lorem imposed text and change this programmatically in the viewDidLoad()
This was the fix for me, and from the research I have done on the issue it seems this is a bug in iOS 9 and Xcode 7.
Cheers!
NOTE: Removing the text in the UITextView (or making it longer then ~12 characters) is sufficient to work around it, no need to delete and recreate them. This is fixed in Xcode 7.1.1 and later.
I ran into the same issue and the fixes in this post (Xcode 7 crash: [NSLocalizableString length] 30000) solved the issue for me.
The first is to enable a localisation other than the base for the storyboard (see https://stackoverflow.com/a/32688815/3718974)
The second is to turn off the base localisation (see https://stackoverflow.com/a/32719247/3718974)
I think I have the same problem: I have a UITabelView with cells created from a nib file, when a user tap a cell this method is called:
and when I have the following method prepareForSegue:: the application crashes:
if I delete the line 129 Everything is ok , the method prepareForSegue:: open the right view and the label contactName is shown with its default text.
If I modify the method as follows prepareForSegue:: get exactly what you expect, without having any type of error:
let me know if you also get the same result
Any one who is facing this issue, i solved it by turning off the "Optimize rendering for windows scale" option in Debug of simulator window. I already had tried all of the above answers but could not solve the issue.
In the method in the first viewController where you activate the segue, do you have beginIgnoringInteractionEvents anywhere? If so the screen you segue to will be frozen and will ignore interaction events like you describe. If this is the case you can fix this by adding an endIgnoringInteractionEvents method before your segue method:
UIApplication.sharedApplication().endIgnoringInteractionEvents()
self.performSegueWithIdentifier("editItemToMyGearSegue", sender: self)
I realize this is an old topic, but appears to be still relevant. I was facing the same problem in Xcode 9, iOS11. My UITextViews are embedded inside UITableViewCells. Same symptoms as described here. The tricks with default text and placeholders did nothing for me, but I solved it by turning off the scrolling indicators for the text view in the xib. They were on by default, I guess, though unused.
Edit: this is probably an important detail... the views that were hanging all had an image NSTextAttachment in the attributed string of the text view. I think the image was wider than the available table cell content. With scrolling turned off, they appear to downscale.

UICollectionview with uidynamics reload data issue

I have been working on an app that uses UIDynamics in UICollectionView. I have watched Apple WWDC video and have also tried this sample app in Github.
However, I had this weird problem: When my app launches, I set the number of items for my collection view to 0, the app needs to download something from the server then populate the collection view on the main thread. Weirdly, it's (kinda) reloaded, but not showing anything. I tried on the sample app from Github and it has the same issue as well.
However, if I remove this part:
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect{
return [self.dynamicAnimator itemsInRect:rect];
}
The CollectionView will show what I want but without the UIDynamics.
I hope the illustration on my problem is easy to understand. Any help will be much appreciated. My guess is I shouldn't use reloaddata.

Tableview crash when deleting rows in UITableView - Style:plain and section footers

I've got a tableview backed by a fetchedresultscontroller. When I delete a row that causes the bottom row of a tableview to scroll up so the tv doesn't fill the entire screen, I get the crash below.
Here are the workarounds I've found.
If I change the tableview to be grouped rather than plain - the error goes away.
If I remove the section footers - the error goes away. This is not a viable workaround for me.
The error occurs after "controllerWillChangeContent" and prior to the "controllerDidChangeContent" - the code here is just copy/pasted from Apple's FRC protocol reference.
Anyone know why this occurs? Since it works fine with Grouped tableview it seems like it's likely an Apple bug - but I thought I'd ask here first before reporting it.
Assertion failure in -[UIViewAnimation initWithView:indexPath:endRect:endAlpha:startFraction:endFraction:curve:animateFromCurrentPosition:shouldDeleteAfterAnimation:editing:], /SourceCache/UIKit_Sim/UIKit-2903.23/UITableViewSupport.m:2661
2014-03-08 17:13:29.226 workbox[7527:70b] CoreData: error: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. Cell animation stop fraction must be greater than start fraction with userInfo (null)
Sample program
I have download your project on github, tested on a iPad Air.
I have clicked on some elements and even when the app should scroll up because you have many elements, no problems/crash at all
I have tested on a xCode 7.3.2 and iPad Air 9.2. simulator
Could you please, say with wich device it's crash?

Resources