A fix is available
APAR status
Closed as program error.
Error description
When an iOS application is launched and installed, it doesn't start properly and an error similar to the following is present in the log. [ERROR] Client init failed. Connection to the service is not available. However, the service is up and running fine.
Local fix
On the last line of postInitOnMainThread in WLCordovaAppDelegate, the following line may be added: [[NSNotificationCenter defaultCenter] postNotificationName:@"finishLoadingWebView" object:nil]; This will let user register the event of finishLoadingWebView.
Problem summary
**************************************************************** * USERS AFFECTED: Users with iOS applications that load * * remote content from the server * * very early during startup. * **************************************************************** * PROBLEM DESCRIPTION: In an attempt to get an iOS * * application * * to start up quickly, steps are often * * taken in a separate thread to get work * * done in parallel. If this is the * * case, and an attempt is made to * * load remote content from the * * server, there is a chance that the * * webview used to display the content * * will not yet be initialized. That * * will result in the error "Connection * * to the service is not available" being * * present in the log. * **************************************************************** * RECOMMENDATION: * **************************************************************** This problem was discovered in sample module_45_2_ContainerForAdvancedPages. Changes that caused this problem were triggered by trying to get the application to load as quickly as possible (iOS guidelines limitations), and do all the heavy work in the background in a separate thread. When trying to access the webview on didFinishLoadWithOptions the webview is null because the application loaded quickly but the webview was loaded on separate thread.
Problem conclusion
On the last line of postInitOnMainThread in WLCordovaAppDelegate the following line was added [[NSNotificationCenter defaultCenter] postNotificationName:@"finishLoadingWebView" object:nil]; This will let user register the event of finishLoadingWebView. The application code will be for example: //Additional method used to determine URL for remote loading - (NSString*) getRemoteURL{ NSString* plistLoc =[[NSBundle mainBundle]pathForResource:@"worklight" ofType:@"plist"]; if(plistLoc == nil){ [NSException raise:@"[Remote Load I Error]" format:@"Unable to locate worklight.plist"]; } NSDictionary* wlProps = [NSDictionary dictionaryWithContentsOfFile:plistLoc]; NSString* proto = [wlProps valueForKey:@"protocol"] NSString* host = [wlProps valueForKey:@"host"]; NSString* port = [wlProps valueForKey:@"port"]; //Ensure all required keys are in the plist if(proto == nil || host == nil || port == nil){ [NSException raise:@"[Remote Load I Error]" format:@"host, port and protocol are all required keys in worklight.plist"]; } NSString* baseURL = [NSString stringWithFormat:@"%@://%@:%@%@", proto, host, port, @"/conference"]; return baseURL; } -(void) loadRemoteURL:(NSNotification *)notification { NSURL* remoteURL = [NSURL URLWithString:[self getRemoteURL]]; NSURLRequest* request = [NSURLRequest requestWithURL:remoteURL]; [self.viewController.webView loadRequest:request]; } //Used to remotely load starting page -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loadRemoteURL:) name:@"finishLoadingWebView" object:nil]; BOOL superResult = [super application:application didFinishLaunchingWithOptions:launchOptions]; return superResult; } The fix for this APAR is currently targeted for inclusion in fixpack 5.0.5.1.
Temporary fix
Comments
APAR Information
APAR number
PM80470
Reported component name
MOBILE FNDTN EN
Reported component ID
5725G9200
Reported release
500
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2013-01-12
Closed date
2013-01-17
Last modified date
2013-01-20
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
MOBILE FNDTN EN
Fixed component ID
5725G9200
Applicable component levels
R500 PSY
UP
Rate this page:
Average rating
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.