This commit is contained in:
wushenghua
2017-04-10 18:05:25 +08:00
parent 9159b73d76
commit 123a0275ba
3 changed files with 11 additions and 2 deletions
+1
View File
@@ -3,6 +3,7 @@ platform :ios,8.0
target 'ASHReactNative do target 'ASHReactNative do
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
#React 用了0.42的版本,要在下面的源才有
source 'https://github.com/Artsy/Specs.git' source 'https://github.com/Artsy/Specs.git'
pod 'React' =>'0.42.0' pod 'React' =>'0.42.0'
pod 'React/Core' =>'0.42.0' pod 'React/Core' =>'0.42.0'
+9
View File
@@ -113,6 +113,15 @@
- (void)rnView:(ASHRNView *)rnView didFailed:(NSError *)error - (void)rnView:(ASHRNView *)rnView didFailed:(NSError *)error
{ {
[MBProgressHUD hideHUDForView:self.view animated:YES]; [MBProgressHUD hideHUDForView:self.view animated:YES];
MBProgressHUD* progressHUD = [[MBProgressHUD alloc] initWithFrame:self.view.bounds];
progressHUD.removeFromSuperViewOnHide = YES;
progressHUD.center = self.view.center;
progressHUD.label.text = @"加载失败";
[self.view addSubview:progressHUD];
[progressHUD showAnimated:YES];
[progressHUD hideAnimated:YES afterDelay:1.0];
} }
- (void)rnViewDidRenderFinish:(ASHRNView *)rnView - (void)rnViewDidRenderFinish:(ASHRNView *)rnView
{ {
+1 -2
View File
@@ -20,8 +20,7 @@
AFHTTPSessionManager* sessionManager = [AFHTTPSessionManager manager]; AFHTTPSessionManager* sessionManager = [AFHTTPSessionManager manager];
NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
NSURLSessionDownloadTask* task = [sessionManager downloadTaskWithRequest:request progress:nil destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) { NSURLSessionDownloadTask* task = [sessionManager downloadTaskWithRequest:request progress:nil destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
// return [NSURL fileURLWithPath:filePath]; return [NSURL fileURLWithPath:filePath];
return [NSURL URLWithString:filePath];
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) { } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
if (!error) { if (!error) {
if (completedBlock) { if (completedBlock) {