SWRevealViewController and pauseInteractiveTransition not implemented - ios

I use SWRevealViewController in a lot of my projects. Since updating to Swift 3 with an iOS deployment target of 10.0 or higher, I am now getting a warning Method 'pauseInteractiveTransition' in protocol 'UIViewControllerContextTransitioning' not implemented in SWRevealViewController.m
I see that this is a required for UIViewControllerContextTransitioning but I have no idea how to implement it. So I just added this
- (void)pauseInteractiveTransition {
// not implemented
}
Everything is working fine but I want to know if there is something else I should do.

Related

Issue facing for xcode-ui-testing in XCode 9

UI Test for an ios-app, developed in XCode 8 and swift 3.2.
Facing problem to deal with ScrollViews, collectionViews after upgrade XCode to 9
I can tap and access the Buttons, StaticTexts, TextFields elements.
But I can not tap or access the collectionviews, scrollviews, tableviews elements on XCode9 and Swift 3.2.
Suppose in the previous XCode version (i.e, XCode 8.3) I used the code app.collectionViews.collectionViews.cells.images.element(boundBy: 0).tap()
to tap on Home page(collectionViews). But this code is not working in XCode 9.
I tried to get the exact element using uitest recording feature.
By using recording I got the code -
app.collectionViews.otherElements.containing(.textField, identifier:"StoryboardTitleTextField").children(matching: .collectionView).element.tap().
But this code isn't working too. So how can I resolve this?
Thanks
Recently i also faced the similar type of issue after upgrading my project(Swift 3.2) into XCode 9.
The issue is
app.collectionViews.collectionViews.cells.images.element(boundBy: 0).isHittable is returning false.
Thats why default tap() method is not working for hierarchical elements.
I just did the below procedure and that worked fine.
Step 1: Create an extension like below
extension XCUIElement {
func tryClick() {
if self.isHittable {
self.tap()
}
else {
let coordinate: XCUICoordinate = self.coordinate(withNormalizedOffset: CGVector(dx:0.5, dy:0.5))
coordinate.doubleTap()
//coordinate.press(forDuration: 0.5)
}
}
}
Step 2: click on the element using the instance method created above instead of using direct tap() method.
app.collectionViews.collectionViews.cells.images.element(boundBy: 0).tryClick()
Note: try using
CGVector(dx:0.5, dy:0.5) or CGVector(dx:0.0, dy:0.0)
Hope it will solve your issue. It worked like a charm for me.

Could not load NIB in bundle...MSSTabBarCollectionViewCell

I have a Swift iOS project and I installed MSSTabbedPageViewController using CocoaPods. I successfully:
Created an Objective-C Bridging Header
Made one of my ViewControllers a subclass of MSSTabbedPageViewController and implemented the required methods
But When I click the tab that is supposed to present the MSSTabbedPageViewController, the app crashes and gives me the error from the title of this question.
How do I fix this?

Objective-C: Coding for various iOS versions

I was wondering whether it is possible / how it is possible to code a class so it can be run on different iOS versions in Objective-C. For example the VisualEffectView is only available in iOS8 and after. Is it possible to declare a VisualEffectView if iOS >= 8 and UIView if not? If so can this be done within a header file?
I want to create an alert box to appear on top of a view controller when a save completes or error occurs. Depending on the iOS version it would be nice if a fancy blurry view is used or just a flat UIView.
In an if statement, use NSClassFromString. You'll discover immediately that UIVisualEffectView doesn't exist when it returns nil, and thus you can take one branch if it exists and another if it doesn't:
if (!NSClassFromString(#"UIVisualEffectView")) {
// ... use UIView ...
} else {
// ... use UIViewVisualEffectView ... {
}
As of iOS 5 you can the following syntax.
if ([UIVisualEffectView class]) {
// Create and use a UIVisualEffectView
}
This will occasionally bite you, NSMapTable is available in iOS versions prior to iOS 6, but was only "officially" available in iOS 6. When attempting to use it in iOS 5 there was some sporadic undocumented behavior.
As many have suggested, you can use the NSClassFromString function to find out at run time if the OS version has the class. If it doesn't (that is iOS 7 devices) and you still want live blurring, I'd recommend LiveFrost.

UIActionSheet on iOS8

I have an app that connects to Chromecast - I referenced from the Chromecast Sample Code which uses UIActionSheet to display the list of Chromecast devices I can connect to.
This was working well for my app which has been running with BaseSDK=iOS6.1. Recently I tried to upgrade to BaseSDK=iOS8.1 and the UIActionSheet doesn't show anymore.
I understand that it has been deprecated in iOS8, but does that mean it wont work anymore? I thought deprecated methods typically take some time to "phase out".
So my main questions are:-
Can I still use only UIActionSheet? Is it just a matter of view hierarchies being changed which is why my ActionSheet is not showing anymore?
If the answer to question 1 is NO, what can I do to allow compatibility with both iOS7 and iOS8.
With iOS8.1 sdk UIActionSheet is deprecated, you should do runtime check to see if it is available and act accordingly using correct class:
if objc_getClass("UIAlertController") != nil {
// UIAlertController is available use it with style UIAlertControllerStyleActionSheet
} else {
// no UIAlertController use regular old action sheet
}
For iOS8 and you above, you will have to migrate to the UIAlertController for both the action sheet and alert pop up.
In all honesty, I find the new API easier to work with. There is a little more here (in Swift, but not any harder in Objective C).

Subclassing UIRefreshControl but still supporting iOS 5.1?

Added a UIRefreshControl to one of my tableviews here, and just used respondsToSelector on the the tableview controller to see if it has the refreshControl property before configuring and adding the UIRefreshControl using NSClassFromString(). Works perfectly and I can continue supporting iOS 5.1 (just without them getting the new control).
However… I want to override the beginRefreshing and endRefreshing methods to dynamically change the tint color of the control. And I figured subclassing UIRefreshControl would be the easiest way of doing this. But how would I do that and still support iOS 5.1?
Actually, assuming your base SDK is at least iOS 6.0, you can subclass UIRefreshControl as long as your deployment target is iOS 3.1 or later. That's because in iOS 3.1, support was added for weakly-linked classes.
With weakly-linked classes, if you send a message to a class that is not present in the running OS, it is the same as messaging nil. Thus, instead of using NSClassFromString(), you can just do this:
if ([UIRefreshControl class]) {
// Use it
}
else {
// Do something else
}
This works even when messaging your own subclass of a weakly-linked class. As Apple's "SDK Compatibility Guide" says,
If you subclass a weakly linked class and the superclass is unavailable, then the subclass also appears unavailable.
So you can just do this:
if ([MyRefreshControl class]) {
MyRefreshControl *control = [[MyRefreshControl alloc] init];
// Do something with the control
}
else {
// Do something else
}
This will work on devices running iOS 5.1 just as well as it works on devices running iOS 6. Your problem is solved.

Resources