You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ji...@apache.org on 2019/04/08 06:23:07 UTC

[incubator-weex] branch master updated: [iOS] Add bundle response url in options dictionary.

This is an automated email from the ASF dual-hosted git repository.

jianhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new 6c74fb7  [iOS] Add bundle response url in options dictionary.
     new 0c87334  Merge pull request #2284 from wqyfavor/add-bundle-response-url
6c74fb7 is described below

commit 6c74fb76355d61304422fc789b2a929eb1844b94
Author: wqyfavor <qi...@taobao.com>
AuthorDate: Mon Apr 8 14:06:36 2019 +0800

    [iOS] Add bundle response url in options dictionary.
---
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
index 33d0d79..807ac55 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
@@ -54,6 +54,7 @@
 #define WEEX_LITE_URL_SUFFIX           @"wlasm"
 
 NSString *const bundleUrlOptionKey = @"bundleUrl";
+NSString *const bundleResponseUrlOptionKey = @"bundleResponseUrl";
 
 NSTimeInterval JSLibInitTime = 0;
 
@@ -486,6 +487,14 @@ typedef enum : NSUInteger {
      [self.apmInstance onStage:KEY_PAGE_STAGES_DOWN_BUNDLE_START];
     _mainBundleLoader.onFinished = ^(WXResourceResponse *response, NSData *data) {
         __strong typeof(weakSelf) strongSelf = weakSelf;
+        if (strongSelf == nil) {
+            return;
+        }
+        
+        NSMutableDictionary* optionsCopy = [strongSelf->_options mutableCopy];
+        optionsCopy[bundleResponseUrlOptionKey] = [response.URL absoluteString];
+        strongSelf->_options = [optionsCopy copy];
+        
         NSError *error = nil;
         if ([response isKindOfClass:[NSHTTPURLResponse class]] && ((NSHTTPURLResponse *)response).statusCode != 200) {
             error = [NSError errorWithDomain:WX_ERROR_DOMAIN