image.png
New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).
今天给用户上传app之后,发现appstoreConnect没有同步binary文件,找了下邮件,发现已经被打回来了,第一反应是程序里面用了uiwebview,全局搜了下也没有,用户用的react-native版本是0.59.8版本,所以webview还是内置在react-native库中,看来苹果的意思是原生代码里面还有uiwebview……
109376349-77299a80-7889-11eb-880f-3a108cba1990.png
删除以下文件,清除缓存,重新打包
109376387-b6f08200-7889-11eb-8424-e7f12b86a939.png
重新archive,发现xcode提示找不到以上四个文件……,我又想了个办法,重写了RCTWebview,只让它反回空的UIView
RCTWebView.h
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <React/RCTView.h>
@class RCTWebView;
/**
* Special scheme used to pass messages to the injectedJavaScript
* code without triggering a page load. Usage:
*
* window.location.href = RCTJSNavigationScheme + '://hello'
*/
extern NSString *const RCTJSNavigationScheme;
@protocol RCTWebViewDelegate <NSObject>
- (BOOL)webView:(RCTWebView *)webView
shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
withCallback:(RCTDirectEventBlock)callback;
@end
@interface RCTWebView : RCTView
@property (nonatomic, weak) id<RCTWebViewDelegate> delegate;
@property (nonatomic, copy) NSDictionary *source;
@property (nonatomic, assign) UIEdgeInsets contentInset;
@property (nonatomic, assign) BOOL automaticallyAdjustContentInsets;
@property (nonatomic, assign) BOOL messagingEnabled;
@property (nonatomic, copy) NSString *injectedJavaScript;
@property (nonatomic, assign) BOOL scalesPageToFit;
- (void)goForward;
- (void)goBack;
- (void)reload;
- (void)stopLoading;
- (void)postMessage:(NSString *)message;
- (void)injectJavaScript:(NSString *)script;
@end
RCTWebView.m
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTWebView.h"
#import <UIKit/UIKit.h>
#import "RCTAutoInsetsProtocol.h"
#import "RCTConvert.h"
#import "RCTEventDispatcher.h"
#import "RCTLog.h"
#import "RCTUtils.h"
#import "RCTView.h"
#import "UIView+React.h"
NSString *const RCTJSNavigationScheme = @"react-js-navigation";
static NSString *const kPostMessageHost = @"postMessage";
@interface RCTWebView ()
@end
@implementation RCTWebView
{
UIView *_webView;
NSString *_injectedJavaScript;
}
- (instancetype)initWithFrame:(CGRect)frame
{
return self;
}
- (void)goBack
{
}
- (void)reload
{
}
- (void)stopLoading
{
}
- (void)postMessage:(NSString *)message
{
}
- (void)injectJavaScript:(NSString *)script
{
}
- (void)setSource:(NSDictionary *)source
{
}
- (void)layoutSubviews
{
}
- (void)setContentInset:(UIEdgeInsets)contentInset
{
}
- (void)setScalesPageToFit:(BOOL)scalesPageToFit
{
}
- (BOOL)scalesPageToFit
{
return YES;
}
- (void)setBackgroundColor:(UIColor *)backgroundColor
{
CGFloat alpha = CGColorGetAlpha(backgroundColor.CGColor);
_webView.backgroundColor = backgroundColor;
}
- (UIColor *)backgroundColor
{
return _webView.backgroundColor;
}
- (NSMutableDictionary<NSString *, id> *)baseEvent
{
return NULL;
}
- (void)refreshContentInset
{
}
@end