Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 13 适配问题反馈 #234

Open
xiaohange opened this issue Sep 21, 2019 · 23 comments
Open

iOS 13 适配问题反馈 #234

xiaohange opened this issue Sep 21, 2019 · 23 comments
Labels

Comments

@xiaohange
Copy link

ios13多处卡死

@Resoulte
Copy link

searchTextField为空崩溃

@renmoqiqi
Copy link

PYSearchViewController
处Client error attempting to change layout margins of a private view’

@ieliwb
Copy link

ieliwb commented Sep 22, 2019

相同的问题,求修复

@Resoulte
Copy link

没人维护了吗

@ko1o ko1o added the bug label Sep 23, 2019
@ko1o
Copy link
Owner

ko1o commented Sep 23, 2019

@xiaohange 麻烦能录个视频或者复现路径说下嘛 我这边测试没有发现问题

@davieds
Copy link

davieds commented Sep 23, 2019

更改色值应该就可以看出具体的问题了。
搜索框的UI样式,跟之前的发生了变化,圆角的弧度,光标的颜色,字体的大小。

#define HexRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
这个是设置的颜色
searchViewController.searchBarBackgroundColor = HexRGB(0x000000); searchViewController.searchSuggestionView.backgroundColor = HexRGB(0x2D2D2D); searchViewController.view.backgroundColor = HexRGB(0x2D2D2D); searchViewController.searchTextField.textColor = HexRGB(0x9B9B9B);

@ko1o

Simulator Screen Shot - iPhone 11 - 2019-09-23 at 14 55 21

@zczzz
Copy link

zczzz commented Sep 23, 2019

遇到相同的问题,求修复

@ko1o
Copy link
Owner

ko1o commented Sep 24, 2019

iOS 麻烦大家有问题在这里列举反馈哈

@ko1o ko1o changed the title ios13 Bug~ iOS 13 适配问题反馈 Sep 24, 2019
@davieds
Copy link

davieds commented Sep 25, 2019

自己回复吧,在iOS13里边UISearchBar自带searchTextField,所以在PYVc的内部里边需要增加iOS13的兼容,如果不想调整的话,可以在外边进行样式的设置。

例如:


PYSearchViewController *searchViewController = [PYSearchViewController searchViewControllerWithHotSearches:strArr searchBarPlaceholder:@"搜索内容" didSearchBlock:^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText) {
       
    }];
    // 3. Set style for popular search and search history
    searchViewController.hotSearchStyle = PYHotSearchStyleBorderTag;
    searchViewController.searchHistoryStyle = PYHotSearchStyleDefault;
    searchViewController.removeSpaceOnSearchString = NO;

if (@available(iOS 13, *)) {
        NSMutableAttributedString *arrStr = [[NSMutableAttributedString alloc]initWithString:searchViewController.searchBar.searchTextField.placeholder attributes:@{NSForegroundColorAttributeName : HexRGB(0x9B9B9B) ,NSFontAttributeName:[UIFont systemFontOfSize:13]}];
        searchViewController.searchBar.searchTextField.attributedPlaceholder = arrStr;
        searchViewController.searchBar.searchTextField.textColor = HexRGB(0x9B9B9B);
        searchViewController.searchBar.layer.cornerRadius = 15;
        searchViewController.searchBar.layer.masksToBounds = YES;
        searchViewController.searchBar.searchTextField.backgroundColor = HexRGB(0x000000);
        searchViewController.searchBar.searchTextField.textColor = HexRGB(0x9B9B9B);
        searchViewController.searchBar.searchTextField.tintColor = [UIColor whiteColor];
        searchViewController.searchBar.searchTextField.font = [UIFont systemFontOfSize:13];

    }

@LeftLee
Copy link

LeftLee commented Oct 9, 2019

iOS 13 设置searchTextField样式,会出现崩溃的问题,模态弹出的样子也注意一下。希望能够维护一下。

@ghost
Copy link

ghost commented Oct 16, 2019

iOS13,设置searchTextField和cancelButton崩溃,提示是nil

@RiberWang
Copy link

RiberWang commented Oct 17, 2019

iOS 13可直接获取searchBar的searchTextField,遍历不到了!暂时用这个解决吧!

if (@available(iOS 13, *)) {
    _searchTextField = searchBar.searchTextField;
}
else {
    for (UIView *subView in [[searchBar.subviews lastObject] subviews]) {
        if ([[subView class] isSubclassOfClass:[UITextField class]]) {
            UITextField *textField = (UITextField *)subView;
            textField.font = [UIFont systemFontOfSize:16];
            _searchTextField = textField;
            break;
        }
    }
}

@xiaohange
Copy link
Author

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:searchViewController];
[self presentViewController:nav animated:YES completion:nil];
开启了联想~

上面的操作会使界面卡死, 报错如下:

[LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
	(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
	<NSAutoresizingMaskLayoutConstraint:0x600001ca32f0 UISearchBar:0x7f8388e4a840.(null) == 2>,
	<NSLayoutConstraint:0x600001ca4c30 UISearchBar:0x7f8388e4a840.left == UIView:0x7f8388e4a6e0.left>,
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600001ca4c30 UISearchBar:0x7f8388e4a840.left == UIView:0x7f8388e4a6e0.left>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

@xiao99xiao
Copy link
Contributor

Made a possible fix in my fork xiao99xiao@243a976

@xiaohange
Copy link
Author

Made a possible fix in my fork xiao99xiao@243a976

Thanks!

@xiaohange
Copy link
Author

Simulator Screen Shot - iPhone 11 Pro Max - 2019-10-17 at 18 58 41
@xiao99xiao 我试了试你那个方法, 模拟器还是会卡到这个界面, 界面会卡死不能交互

@xiao99xiao
Copy link
Contributor

@xiaohange 你那个卡死大概率不是那个constraint导致的。你先fullscreen present看看还会不会卡死。

@xiaohange
Copy link
Author

@xiaohange 你那个卡死大概率不是那个constraint导致的。你先fullscreen present看看还会不会卡死。

找到原因了, 你那个修复是有效的, 卡死的原因是 IQKeyboardManager 的 bug, IQKeyboardManager 引起的 _textfieldText无法输入, 再次表示感谢!

@blmyself
Copy link

@xiaohange 你那个卡死大概率不是那个constraint导致的。你先fullscreen present看看还会不会卡死。

找到原因了, 你那个修复是有效的, 卡死的原因是 IQKeyboardManager 的 bug, IQKeyboardManager 引起的 _textfieldText无法输入, 再次表示感谢!

我也用到了IQKeyboardManager,请问这个Bug怎么解决的?

@xiao99xiao
Copy link
Contributor

xiao99xiao commented Oct 28, 2019

@blmyself 自己对PYSearchViewController禁用IQKeyboardManager应该就好了。
参看IQKeyboardManager的README https://github.com/hackiftekhar/IQKeyboardManager/blob/master/README.md

If IQKeyboardManager conflicts with other third-party library, then it's developer responsibility to enable/disable IQKeyboardManager when presenting/dismissing third-party library UI. Third-party libraries are not responsible to handle IQKeyboardManager.

@zhaochong0804
Copy link

ios13崩溃遍历不到的问题可以这么样遍历
if (@available(iOS 13, *)) {
for (id subView1 in [searchBar subviews]) {
for (id subView2 in [subView1 subviews]) {
for (id subView3 in [subView2 subviews]) {
if ([subView3 isKindOfClass:[UITextField class]]) {
UITextField *textField = (UITextField *)subView3;
textField.backgroundColor = [UIColor colorWithHex:@"#F6F6F6"];
textField.font = FONT(14);
textField.layer.cornerRadius = 32/2;
textField.layer.masksToBounds = YES;
_searchTextField = textField;
break;
}
}
}
}

}else{
    for (UIView *subView in [[searchBar.subviews lastObject] subviews]) {
        if ([[subView class] isSubclassOfClass:[UITextField class]]) {
            UITextField *textField = (UITextField *)subView;
            textField.backgroundColor = [UIColor colorWithHex:@"#F6F6F6"];
            textField.font = FONT(14);
            textField.layer.cornerRadius = 32/2;
            textField.layer.masksToBounds = YES;
            _searchTextField = textField;
            break;
        }
    }
}

@AcYangle
Copy link

搜索结果详情界面需要隐藏导航栏,pop回到搜索界面搜索结果tableView发生偏移
image

@blmyself
Copy link

@blmyself 自己对PYSearchViewController禁用IQKeyboardManager应该就好了。
参看IQKeyboardManager的README https://github.com/hackiftekhar/IQKeyboardManager/blob/master/README.md

If IQKeyboardManager conflicts with other third-party library, then it's developer responsibility to enable/disable IQKeyboardManager when presenting/dismissing third-party library UI. Third-party libraries are not responsible to handle IQKeyboardManager.

禁用了也还是卡死的,还有别的解决方法么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests