0
장치 기본값으로 인해 텍스트가 자동으로 수정되는 잠재 고객 테스트에서 문제가 발생합니다.서브 식으로 자동 고침 사용 안 함
Subliminal을 사용하여 전체 기기에서 자동 수정 기능을 사용 중지 할 수있는 방법이 있습니까? 어떻게 든 장치 설정으로 이동할 수 있습니까?
장치 기본값으로 인해 텍스트가 자동으로 수정되는 잠재 고객 테스트에서 문제가 발생합니다.서브 식으로 자동 고침 사용 안 함
Subliminal을 사용하여 전체 기기에서 자동 수정 기능을 사용 중지 할 수있는 방법이 있습니까? 어떻게 든 장치 설정으로 이동할 수 있습니까?
잠재적으로는 장치 설정으로 탐색 할 수 있지만 테스트는 method swizzling의 비트와 함께 기본 텍스트 필드 자동 수정 유형을 재정의 할 수
// In the test that exercises the text fields,
// or a base test class of multiple tests that exercise text fields
#import <objc/runtime.h>
- (void)setUpTest {
// `dispatch_once` in case this is a base test class,
// where this method would be called multiple times
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
struct objc_method_description autocorrectionTypeMethodDescription = protocol_getMethodDescription(@protocol(UITextInputTraits), @selector(autocorrectionType), NO, YES);
// (Re)implement `-[UITextField autocorrectionType]` to return `UITextAutocorrectionTypeNO`.
IMP noAutocorrectionTypeIMP = imp_implementationWithBlock(^(UITextField *_self){ return UITextAutocorrectionTypeNo; });
class_replaceMethod([UITextField class], @selector(autocorrectionType), noAutocorrectionTypeIMP, autocorrectionTypeMethodDescription.types);
});
}