UIButton not showing on real device while running on Xcode8 - ios10

Today i run my project on Xcode8. Before that it was executed good and shown all button properly. when i run project on xcode8 simulator and device. few buttons not visible on run time but action performing.
Please assist me on this issue.

Actually, There are some problems in Xcode 8 compiler.
I were having such issue, i have resolved by doing following things
If i have done anyoperation on layer(cornerRadius,bordering,masksToBounds etc.) in viewDidLoad/viewWillAppear/awakeFromNib then move them to either layoutSubViews method or viewDidAppear method.
If I have set left/right view in textfield, then move it also to viewDidAppear or layoutSubviews.
Try most of UI Related operation in viewDidAppear or layoutSubviews

Related

View doesnt navigate in real ipad device but works fine in emulator

In a button click I am navigating the view to another xib which works fine in real iphone device, ipad iphone both emulators but not in real ipad. Here is my code :
-(IBAction)cardAnimation{
ViewController_ipad *view = [[ViewController_ipad alloc]initWithNibName:#"ViewController_ipad" bundle:nil];
[self.navigationController pushViewController:view animated:YES];
}
but one thing to be noticed that I have done NSLog in my destination class's viewdidload method and surprisingly that thing is being logged though that view is not being loaded at all by the above code. What can be the problem?
I think you have a MainWindow~ipad.xib file that is referenced through your AppDelegate and you also tried to alloc the Window in your didFinishLaunchingWithOptions: method in your AppDelegate file. For which there might be some problem occurred. Whenever you are trying to push your navigation controller, it is actually pushing, but not showing the next controller may be because of the Window over that controller.
It might solve your problem:
Go to your Project settings (not through File->Project Settings) by clicking on your Project at the left panel/navigator -> select your TARGET and go to Summary Tab -> scroll down to iPad deployment Info -> there you'll find the Main Interface option -> remove the name "MainWindow_iPad" and left it empty and save it. Run the application in your iPad and it will work fine.
Best of luck. :-)
N.B: Don't forget to clean your build and remove the application from your device before you go for the new build.
The iPhone simulator is case-insensitive for file names. The devices are case- sensitive. Check to make sure that your nib name isn't actually Viewcontroller_ipad or ViewController_iPad or another variation. This behavior once got me trying to use an image file in my app - it would work in the Simulator, not on device.
Try a fresh install (deleting the app), and if you are building from xcode hold Option and go to Product - > Clean Build Folder
Also are you naming your nibs with ~iphone and ~ipad?
I faced the same problem, i had problem with my iPad (iOS 5.1.1).
When i was pressing button but that was not responding.
That is because of i added UIGestureRecognizer on self.view.
I solved this problem by adding gestureRecognizer on my button. (its just trick not an proper solution, Just implement it if you did not find any other way.)

Adding Pinch/Zoom effect to a UIImageView inside a UIScrollView

I have a very basic screen sharing iPhone app, I have successfully added the pinch/zoom effect to my app using a UIImageView inside a UIScrollView.
The UIImageView receives the screen content from the PC on a regular interval. Everything works fine but as soon as I scroll/pinch/zoom it works at first but then it stops, and the delegate method that's updating the image view content stops firing up even though the server still sends the screen content. The whole app seems to be frozen but there are no error messages/exceptions/whatever. Can anyone help me, please?
If you are using NSDefaultRunLoopMode, UIAPPlication adds a run loop mode UITrackingRunLoopMode for tracking scrollview events like scrolling. Since the UIApplication switches from NSDefaultRunLoopMode to UITrackingRunLoopMode any events on NSDefaultRunLoopMode will not be called until UIAPPlication switch back to NSDefaultRunLoopMode.
It might be the problem, the fix is change NSDefaultRunLoopMode to NSRunLoopCommonModes .
If you are not sure whether you are using runloop or not as you mentioned in comment. Just search NSDefaultRunLoopMode in your project.

iOS 3.1.2 [UIViewController dismissModalViewControllerAnimated:] creates infinite recursion

I have some code that works fine on my iPod Touch running some 4.0-series iOS as well as the simulator that comes with the iOS SDK 4.1. But when I call [UIViewController dismissModalViewController:] on an iPhone 2 running iOS 3.1.2 it get an infinite recursion, eventually crashing.
I have a view controller that opens a table view where the user selects a document to open. Upon selecting a document my table view controller's delegate calls the parent view controllers dismissModalViewController method. I think it is because I'm closing the view controller whose code is running that causes this.
dismissModalViewController is documented to be available in iOS 2.0 and later.
How can I close the UIViewController that's open from its own code?
I figured my problem might be heap corruption from some previous code. A way to debug that is to comment off snippets of previous code to see whether the bug would go away or come back. Almost immediately I found that I was calling dismissModalViewControllerAnimated: on the current view controller's parent controller. Why that works in iOS 4.x I have no idea. The problem I face is that I have two modal dialogs that I need to close simultaneously, which I cannot get working, but that is a different question.

PopViewController not popping view

My top level view immediately Pushes my SplashView in it's ViewWillAppear method. In some conditions, the SplashView pushes an additional view, which is properly popped. When this occurs the Top Level view never appears.
However, the code in the Top Level is running (it has a timer that occurs every minute which writes to the log). And if I trap it in Debug I can see the code executing. Additionally, in the Top Level ViewDidAppear if I log the [self navigationController].visibleViewController.nibName the name of the Top Level appears.
If I don't do the Push in the SplashView everything works fine.
The app is forced into Landscape mode, and each ViewController contains return UIInterfaceOrientationIsLandscape(interfaceOrientation); for the shouldAutorotateToInterfaceOrientation method.
I'm baffled and don't know what to do next. Suggestions?
While I did not exactly determine why this was occurring, I have resolved the problem. Here are some things I noticed in further debugging:
I noticed the message wait_fences: failed to receive reply: 10004003 in the log. Scanning blogs on this didn't help me much, but it led further down the path. References to it showed issues with UIAlertView, which I did have in the Splash view.
I added ViewDidAppear logic to the Splash view, then found this was getting called twice! I then added logic to act on this only once and my problem was solved!
So apparently there is some quirk with the View getting called twice that was creating my initial issue. References I found implied this was an 'old' OS issue, but I am using xCode 3.2.3 and SDK 4.0.2, so maybe it's back! Gee, I don't recall it doing this with SDK 4.0.1!

Crash when calling stringByEvaluatingJavaScriptFromString on UIWebView from button

I can't find any documentation to confirm this, but it appears that you can only call the method stringByEvaluatingJavaScriptFromString in overridden methods from a UIWebView delegate. Can anyone confirm this?
Here's what I've tried. I setup a button on a view, link it to a method on my viewcontroller, and make sure it works fine. My view has a UIWebView control on it as well. If I run the project on the simulator or on the iPhone, there are no issues. Then I add this code to the button's method.
[theWebView stringByEvaluatingJavaScriptFromString:#"alert('Hi there!');"];
When I run the project, I can click the button and see the 'Hi there' prompt and I can click OK to dismiss it. Usually 4-5 seconds later the simulator crashes. I occasionally see the "__TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION__" error, but not consistently; sometimes there's no error. It also doesn't always crash the first time. Sometimes I go to another page, and then try it again, and it crashes.
If I put the same code in the webPageDidFinishLoad event it works fine. But I'd like the code to be called when the user demands it so that event doesn't suit my needs.
I'm open to a workaround if you have any ideas? Thanks in advance!
I still don't know the exact reason this didn't work, but I found I could rewrite my code to get called during the UIWebView delegate methods instead.