Skip to content

Commit

Permalink
优化在线加载资源
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenglibao committed Sep 26, 2019
1 parent 40a2889 commit aa4ef9c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,9 @@
**FlexLib**的所有版本的变更日志都将会在这里记录.

---
## 2.3.6
1.优化在线加载资源,在加载失败情况下自动使用本地资源

## 2.3.5
1.优化缓存目录

Expand Down
2 changes: 1 addition & 1 deletion FlexLib.podspec
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'FlexLib'
s.version = '2.3.5'
s.version = '2.3.6'
s.summary = 'An obj-c flex layout framework for IOS'

# This description is used to generate tags and improve search results.
Expand Down
9 changes: 9 additions & 0 deletions FlexLib/Classes/FlexNode.m
Expand Up @@ -848,6 +848,15 @@ void FlexSetPreviewBaseUrl(NSString* filexName)
if(error != nil){
NSLog(@"Flexbox: loadFromNetwork error: %@",error);
}

// check http result valid
error = nil;
GDataXMLDocument* xmlDoc = [[GDataXMLDocument alloc]initWithData:flexData options:0 error:&error];
if (error!=nil) {
NSLog(@"Flexbox: the online data for %@ not valid, local xml resource used.(%lld)",resName,(SInt64)xmlDoc);

flexData = loadFromFile(resName, owner);
}
return flexData;
}

Expand Down

0 comments on commit aa4ef9c

Please sign in to comment.