How to prevent UISearchBar from shifting up - ios

I put UISearchBar under UIView as the picture below. The problem is - after finish search or click cancel, UISearchBar will shift to the top, then I get error message:
2014-05-22 15:45:18.663 MyAPP[14402:60b] *** Assertion failure in -[UITableView layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2935.137/UIView.m:8794
2014-05-22 15:45:18.667 MyAPP[14402:60b] WARNING: GoogleAnalytics 3.06 void GAIUncaughtExceptionHandler(NSException *) (GAIUncaughtExceptionHandler.m:49): Uncaught exception: Auto Layout still required after executing -layoutSubviews. UITableView's implementation of -layoutSubviews needs to call super.
2014-05-22 15:45:23.697 MyAPP[14402:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UITableView's implementation of -layoutSubviews needs to call super.'
*** First throw call stack:
Question:
1) Is it possible to fix position of UISearchBar? and How to do that?
2) How to fix the error?

Related

Terminating app due to uncaught exception [UIImageView _isResizable]

I'm getting an exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView _isResizable]: unrecognized selector sent to instance 0x7fe01fd0d470'
I just assigned an image to the imageView inside a custom cell using storyboard.
The code is clean. It doesn't have any warnings or errors.
Two reason of this error.
If you want to assign image write.
cell.image=[UIImage imagenamed:#"Name of your image "];
and another reason of this error is you can cut the link of imageView to the outlet.
Again make a new outlet and then check now imageView is working.
i think this will help u.
there may be two or more outlet references to one imageView which makes ambiguous
Please see once the name of image in swift file and StroryBoard. Compare them they must be same.
Also check the identifier of Cell.

UICollectionView dealloc assertion fail crash

Totally stumped on this. When I dismiss my view controller which is being presented with a custom presentation/transition in iOS 8, I get a crash on private API with this error:
*** Assertion failure in -[UICollectionView dealloc], /SourceCache/UIKit/UIKit- 3318.16.21/UICollectionView.m:665
All I know is if I remove any of these:
[self.collectionView performBatchUpdates:^{
// append your data model to return a larger size for
// cell at this index path
} completion:nil];
then it doesn't crash.
But those methods ARE NOT being called on dealloc, dismiss, viewWillDisappear. Literally anything. It's like the invocations or messages are bing stuck in some dimension and called after the view is dismissed. But I can't log them and if I try to put in logic that prevents them being called in that case, it does nothing. Which kinda makes sense: they aren't actually BEING called.
UGH! Ideas?
Update:
I just got a crash with more info (tho still opaque)
malloc: *** mach_vm_map(size=2146844672) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Update 2:
I got it to stop crashing by wrapping some code in:
[self performAfterDelay:0 block:^{
//batch updates
}];

Display annotation view crashes on iOS 6

I'm working on an app that has a MKMapView with annotations. Everything works fine on iOS7, but when I try it on iOS6, as I tap on an annotation, the app crashes with :
*** Assertion failure in -[MyAnnotationView layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2380.17/UIView.m:5776
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. MyAnnotationView's implementation of -layoutSubviews needs to call super.'
I've added :
- (void)layoutSubviews
{
[super layoutSubviews];
}
to my MyAnnotationView, but nothing changes. I don't really know what to do here.
Thanks for your help !
EDIT :
I am using auto layout. I've tried to add
self.translatesAutoresizingMaskIntoConstraints = NO;
in MyAnnotationView init method, but nothing changes. (I've tried with YES too)

Error when moving view Controller

I get an error saying
*** Assertion failure in -[HatsViewController loadView], /SourceCache/UIKit/UIKit-2380.17/UICollectionViewController.m:104
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UICollectionViewController loadView] loaded the "FCD-ki-UFO-view-1vb-8P-s3C" nib but didn't get a UICollectionView.'
*** First throw call stack:
(0x3467c2a3 0x3c36097f 0x3467c15d 0x34f51ab7 0x368aaa95 0x364a346d 0x3652f353 0x36570d11 0x3656ffe7 0x366923ef 0x3656f0c5 0x3656f077 0x3656f055 0x3656e90b 0x3656ee01 0x364975f1 0x36484801 0x3648411b 0x3818b5a3 0x3818b1d3 0x34651173 0x34651117 0x3464ff99 0x345c2ebd 0x345c2d49 0x3818a2eb 0x364d8301 0xc0dfd 0x3c797b20)
libc++abi.dylib: terminate called throwing an exception
(lldb)
Why does this happen and how can I fix it?
When you’re using a UICollectionViewController, the view outlet needs to be connected to a UICollectionView in your storyboard; if it’s a UIView of another class, it’ll crash.
check HatsViewController.h is inherited from UICollectionViewController but you have connected it view in your storyboard. Either it must be subclass of UIViewController or it is connected to UICollectionView in your storyboard.

App crashes on sudden navigation changes iOS

i am creating an iPhone application with tabbar controller. I have two tabs with tableview controller. In both tabs some web service calls are there and it updates the table contents. I am using a loading indicator and all the service calls are performing on background thread and UI updates on mainthread with waitUntilDone:YES. In normal case everything is working perfect.
But the issue is,if I do sudden changes of tabs repeatedly the app crashes with error message:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x382a62a3 0x3338d97f 0x381f1b75 0x1521f9 0x362fb545 0x362e030b 0x362f77c7 0x362b3803 0x312d1d63 0x312d1901 0x312d2835 0x312d221b 0x312d2029 0x362b98eb 0x3827b6cd 0x382799c1 0x38279d17 0x381ecebd 0x381ecd49 0x3a0ec2eb 0x363042f9 0xcd317 0xc0b70)
libc++abi.dylib: terminate called throwing an exception
I know, its because try to access values from NSArray where there is no contents. But, is there any common reason for this? I mean, if I do tab changes in normal speed there is no issue. But if I try to change the tabs, just after the loading indicator ends, the app crashes. I am not able to track this on the code. Crash is happening in main.m
Please share your ideas.
Update
The issue was happening in
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
at
songTitle.text = [songTitleSH objectAtIndex:indexPath.row];
albumTitle.text = [albumNameSH objectAtIndex:indexPath.row];
artistName.text = [artistNameSH objectAtIndex:indexPath.row];
commentDateLbl.text = [playDateSH objectAtIndex:indexPath.row];
i am getting NULL values in these arrays, that caused the issue. So, how can I overcome this issue? Any idea?

Resources