2016-01-22 74 views
0

我正在为我的iOS应用程序使用azure。首先登录控制器,点击我呼叫Azure的登录服务。白屏在加载Azure登录页面之前已经有一段时间了

[client loginWithProvider:@"xxxxx" controller:self animated:YES completion:^(MSUser *user, NSError *error) 

之前加载Azure的登录页面,我可以看到一个白色的屏幕对于一些5-6秒。

是否可以解决,如果是的话如何?我们需要在Azure SDK for iOS中进行更改吗?

+0

我从来没有使用Azure的SDK这么愚蠢的问题,是位于网页视图该网页?或者它打开你的网页浏览器?登录页面? – NSNoob

+0

它在webview中加载。我们已经尝试在webView中进行更改,但仍然保留白屏幕。 –

+0

你尝试过什么变化?你知道webview必须首先加载页面的权利?为什么不显示活动指示器,直到它加载页面以显示我正在加载,请稍候。 – NSNoob

回答

0

在Azure SDK(https://github.com/Azure/azure-mobile-services/sdk/)中,打开iOS项目并导航到MSLoginView.m。将initWithFrame方法编辑为下面的方法。重新生成框架文件并导入到您的项目中。

-(id) initWithFrame:(CGRect)frame 
     client:(MSClient *)client 
     startURL:(NSURL *)startURL 
     endURL:(NSURL *)endURL 
    completion:(MSLoginViewBlock)completion; 
{ 
    self = [super initWithFrame:frame]; 
    if (self) { 
     // Capture all of the initializer values as properties 
     client_ = client; 
     startURL_ = startURL; 
     endURL_ = endURL; 
     endURLString_ = endURL_.absoluteString;   
     completion_ = [completion copy]; 

     // Create the activity indicator and toolbar 
     activityIndicator_ = [[UIActivityIndicatorView alloc] 
    initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; 
     activityIndicator_.alpha = 1.0; 
     activityIndicator_.center = CGPointMake([[UIScreen mainScreen]bounds].size.width/2, [[UIScreen mainScreen]bounds].size.height/2); 
     [self addSubview:activityIndicator_]; 

     toolbar_ = [self createToolbar:activityIndicator_]; 
     [self addSubview:toolbar_]; 

     // Set the toolbar defaults 
     showToolbar_ = NO; 
     toolbarPosition_ = UIToolbarPositionBottom; 

     // Create the webview 
     webView_ = [[UIWebView alloc] init]; 
     [webView_ setOpaque:NO]; 
     webView_.backgroundColor = [UIColor clearColor]; 

     webView_.scrollView.scrollEnabled = NO; 
     webView_.scrollView.multipleTouchEnabled = NO; 
     [webView_.scrollView setBouncesZoom:NO];//disable ZOOM Functionality 
     webView_.scalesPageToFit = YES; 
     webView_.delegate = self; 
     [self addSubview:webView_]; 
     webView_.hidden =YES; 


     // Call setViewFrames to update the subview frames 
     [self setViewFrames]; 

     // Start the first request 
     NSURLRequest *firstRequest = [NSURLRequest requestWithURL:startURL]; 
     [webView_ loadRequest:firstRequest]; 
    } 
    return self; 
} 

@ user203538:让我知道如果你得到所需的输出

+0

如何修改.m文件?我只在框架中看到头文件.h。 – Ruben

+0

您可以从https://github.com/Azure/azure-mobile-services下载具有不同平台框架的源代码。转到sdk - > iOS并打开xcodeproj。修改上述文件,保存并关闭项目。然后在同一个层次结构中有一个文件build.command,双击该文件以生成更新的框架。将该框架用于您的项目。 –

+0

它有效吗?如果需要帮助,请告诉我。 –

相关问题