UIWebView和URLRequest拦截

时间:2018-12-13 21:36:45

标签: ios swift uiwebview nsurlconnection wkwebview

我试图了解UIWebView中的请求拦截问题,以便可以开始研究WKWebView。

我不明白的是,UIWebView有自己的拦截方法,它应该是shouldStartLoadWithRequest,但似乎大多数人仍在实现自定义NSURLProtocol来进行拦截。我很好奇为什么大多数人选择不使用UIWebView的方法?这里有什么区别?

1 个答案:

答案 0 :(得分:0)

如果您只想加载或拒绝请求,则可以在dense_layers = [0] layer_sizes = [64] conv_layers = [3] for dense_layer in dense_layers: for layer_size in layer_sizes: for conv_layer in conv_layers: NAME = "{}-conv-{}-nodes-{}-dense-{}".format(conv_layer, layer_size, dense_layer, int(time.time())) print(NAME) model = Sequential() model.add(Conv2D(layer_size, (3, 3), input_shape=(60, 60, 3))) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(2, 2))) for l in range(conv_layer-1): model.add(Conv2D(layer_size, (3, 3))) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Flatten()) for _ in range(dense_layer): model.add(Dense(layer_size)) model.add(Activation('relu')) model.add(Dense(1)) model.add(Activation('sigmoid')) tensorboard = TensorBoard(log_dir="logs/") model.compile(loss='sparse_categorical_crossentropy', optimizer='adam', metrics=['accuracy'], ) model.fit(X_norm, y, batch_size=32, epochs=10, validation_data=(X_norm_test,y_test), callbacks=[tensorboard]) 中通过成为其Epoch 1/10 42798/42798 [==============================] - 27s 641us/step - loss: nan - acc: 0.0115 - val_loss: nan - val_acc: 0.0114 Epoch 2/10 42798/42798 [==============================] - 27s 638us/step - loss: nan - acc: 0.0115 - val_loss: nan - val_acc: 0.0114 Epoch 3/10 42798/42798 [==============================] - 27s 637us/step - loss: nan - acc: 0.0115 - val_loss: nan - val_acc: 0.0114 Epoch 4/10 42798/42798 [==============================] - 27s 635us/step - loss: nan - acc: 0.0115 - val_loss: nan - val_acc: 0.0114 Epoch 5/10 42798/42798 [==============================] - 27s 635us/step - loss: nan - acc: 0.0115 - val_loss: nan - val_acc: 0.0114 Epoch 6/10 42798/42798 [==============================] - 27s 631us/step - loss: nan - acc: 0.0115 - val_loss: nan - val_acc: 0.0114 Epoch 7/10 42798/42798 [==============================] - 27s 631us/step - loss: nan - acc: 0.0115 - val_loss: nan - val_acc: 0.0114 Epoch 8/10 42798/42798 [==============================] - 27s 631us/step - loss: nan - acc: 0.0115 - val_loss: nan - val_acc: 0.0114 Epoch 9/10 42798/42798 [==============================] - 27s 635us/step - loss: nan - acc: 0.0115 - val_loss: nan - val_acc: 0.0114 Epoch 10/10 42798/42798 [==============================] - 27s 626us/step - loss: nan - acc: 0.0115 - val_loss: nan - val_acc: 0.0114 并实现WKWebView

来完成此操作。
WKWebViewNavigationDelegate