@@ -78,11 +78,6 @@ + (NSArray *)routes
78
78
+ (id <FBResponsePayload>)handleCreateSession : (FBRouteRequest *)request
79
79
{
80
80
NSDictionary *requirements = request.arguments [@" desiredCapabilities" ];
81
- NSString *bundleID = requirements[@" bundleId" ];
82
- NSString *appPath = requirements[@" app" ];
83
- if (!bundleID) {
84
- return FBResponseWithErrorFormat (@" 'bundleId' desired capability not provided" );
85
- }
86
81
[FBConfiguration setShouldUseTestManagerForVisibilityDetection: [requirements[@" shouldUseTestManagerForVisibilityDetection" ] boolValue ]];
87
82
if (requirements[@" shouldUseCompactResponses" ]) {
88
83
[FBConfiguration setShouldUseCompactResponses: [requirements[@" shouldUseCompactResponses" ] boolValue ]];
@@ -106,19 +101,25 @@ + (NSArray *)routes
106
101
107
102
[FBConfiguration setShouldWaitForQuiescence: [requirements[@" shouldWaitForQuiescence" ] boolValue ]];
108
103
109
- FBApplication *app = [[FBApplication alloc ] initPrivateWithPath: appPath bundleID: bundleID];
110
- app.fb_shouldWaitForQuiescence = FBConfiguration.shouldWaitForQuiescence ;
111
- app.launchArguments = (NSArray <NSString *> *)requirements[@" arguments" ] ?: @[];
112
- app.launchEnvironment = (NSDictionary <NSString *, NSString *> *)requirements[@" environment" ] ?: @{};
113
- [app launch ];
114
-
115
- if (app.processID == 0 ) {
116
- return FBResponseWithErrorFormat (@" Failed to launch %@ application" , bundleID);
104
+ NSString *bundleID = requirements[@" bundleId" ];
105
+ FBApplication *app = nil ;
106
+ if (bundleID != nil ) {
107
+ app = [[FBApplication alloc ] initPrivateWithPath: requirements[@" app" ]
108
+ bundleID: bundleID];
109
+ app.fb_shouldWaitForQuiescence = FBConfiguration.shouldWaitForQuiescence ;
110
+ app.launchArguments = (NSArray <NSString *> *)requirements[@" arguments" ] ?: @[];
111
+ app.launchEnvironment = (NSDictionary <NSString *, NSString *> *)requirements[@" environment" ] ?: @{};
112
+ [app launch ];
113
+ if (app.processID == 0 ) {
114
+ return FBResponseWithErrorFormat (@" Failed to launch %@ application" , bundleID);
115
+ }
117
116
}
117
+
118
118
if (requirements[@" defaultAlertAction" ]) {
119
- [FBSession sessionWithApplication: app defaultAlertAction: (id )requirements[@" defaultAlertAction" ]];
119
+ [FBSession initWithApplication: app
120
+ defaultAlertAction: (id )requirements[@" defaultAlertAction" ]];
120
121
} else {
121
- [FBSession sessionWithApplication : app];
122
+ [FBSession initWithApplication : app];
122
123
}
123
124
124
125
return FBResponseWithObject (FBSessionCommands.sessionInformation );
0 commit comments