Skip to content

Commit a3da745

Browse files
author
Adam Schlesinger
committed
Log error if cocoapods is not found
1 parent 90a013f commit a3da745

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

com.onesignal.unity.ios/Editor/BuildPostProcessor.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,22 +279,27 @@ private void ExtensionAddPodsToTarget() {
279279

280280
podfile += $"target '{ServiceExtensionTargetName}' do\n pod 'OneSignalXCFramework', '~> 3.8.1'\nend\n";
281281
File.WriteAllText(podfilePath, podfile);
282-
283-
// todo - detect if cocoapods is installed
284-
282+
283+
var installResult = _runShellCommand($"-c \"pod install --project-directory={_outputPath}\"");
284+
if (!installResult.Contains("Installing OneSignalXCFramework"))
285+
Debug.LogError($"Could not detect install with Cocoapods. {ServiceExtensionFilename} may have errors.");
286+
}
287+
288+
private static string _runShellCommand(string command) {
285289
var process = new Process {
286290
StartInfo = new ProcessStartInfo {
287-
FileName = "/bin/bash",
288-
Arguments = $"-c \"pod install --project-directory={_outputPath}\"",
291+
FileName = "/bin/sh",
292+
Arguments = command,
289293
RedirectStandardOutput = true,
290294
UseShellExecute = false,
291295
CreateNoWindow = true,
292296
}
293297
};
294298

295299
process.Start();
296-
Debug.Log(process.StandardOutput.ReadToEnd());
300+
var ret = process.StandardOutput.ReadToEnd();
297301
process.WaitForExit();
302+
return ret;
298303
}
299304
}
300305
}

0 commit comments

Comments
 (0)