@@ -843,25 +843,41 @@ public static void SettingsDialog() {
843
843
/// </summary>
844
844
internal static bool MultipleXcodeTargetsSupported {
845
845
get {
846
- return typeof ( UnityEditor . iOS . Xcode . PBXProject ) . GetMethod (
847
- "GetUnityMainTargetGuid" , Type . EmptyTypes ) != null ;
846
+ try {
847
+ return MultipleXcodeTargetsSupportedInternal ( ) ;
848
+ } catch ( Exception e ) {
849
+ return false ;
850
+ }
848
851
}
849
852
}
850
853
854
+ private static bool MultipleXcodeTargetsSupportedInternal ( ) {
855
+ return typeof ( UnityEditor . iOS . Xcode . PBXProject ) . GetMethod (
856
+ "GetUnityMainTargetGuid" , Type . EmptyTypes ) != null ;
857
+ }
858
+
851
859
/// <summary>
852
860
/// Name of the Xcode main target generated by Unity.
853
861
/// </summary>
854
862
public static string XcodeMainTargetName {
855
863
get {
856
- // NOTE: Unity-iPhone is hard coded in UnityEditor.iOS.Xcode.PBXProject and will no
857
- // longer be exposed via GetUnityTargetName(). It hasn't changed in many years though
858
- // so we'll use this constant as a relatively safe default.
859
- return MultipleXcodeTargetsSupported ? "Unity-iPhone" :
860
- ( string ) VersionHandler . InvokeStaticMethod ( typeof ( UnityEditor . iOS . Xcode . PBXProject ) ,
861
- "GetUnityTargetName" , null ) ;
864
+ try {
865
+ return XcodeMainTargetNameInternal ( ) ;
866
+ } catch ( Exception e ) {
867
+ return "Unity-iPhone" ;
868
+ }
862
869
}
863
870
}
864
871
872
+ private static string XcodeMainTargetNameInternal ( ) {
873
+ // NOTE: Unity-iPhone is hard coded in UnityEditor.iOS.Xcode.PBXProject and will no
874
+ // longer be exposed via GetUnityTargetName(). It hasn't changed in many years though
875
+ // so we'll use this constant as a relatively safe default.
876
+ return MultipleXcodeTargetsSupported ? "Unity-iPhone" :
877
+ ( string ) VersionHandler . InvokeStaticMethod ( typeof ( UnityEditor . iOS . Xcode . PBXProject ) ,
878
+ "GetUnityTargetName" , null ) ;
879
+ }
880
+
865
881
/// <summary>
866
882
/// Name of the Xcode UnityFramework target generated by Unity 2019.3+
867
883
/// </summary>
0 commit comments