facebook-sdk-for-unity
facebook-sdk-for-unity copied to clipboard
Method "PostProcessBuild_iOS" cause build error as building with FBSDK 9.0.0
Checklist
- [x] I've updated to the latest released version of the SDK
- [x] I've searched for existing GitHub issues
- [x] I've looked for existing answers on Stack Overflow, the Facebook Developer Community Forum and the Facebook Developers Group
- [x] I've read the Code of Conduct
- [x] This issue is not security related and can safely be disclosed publicly on GitHub
Environment
Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:
- Unity Editor Version:
2017.4.24f1
- Unity SDK Version:
facebook-sdk-for-unity 9.0.0
- Installation Platform & Verison: [iOS]
Goals
Do not cause the error.
Expected Results
Do not cause the error.
Actual Results
I buid Xcode project with my own pipeline, and import the podfile in the order of PostProcessBuild(100)
. But Facebook SDK use the podfile in the order of PostProcessBuild(45)
and the podfile has not been imported. That causes an error (actually that is an excetion, but Unity show that with error and won't stop the build pipeline.) .
Fortunately, the error has not made the build failed for now.
The exception caused in method Facebook.Unity.Editor.XCodePostProcess.PostProcessBuild_iOS
, ILSpy show the method like this:
[PostProcessBuild(45)]
private static void PostProcessBuild_iOS(BuildTarget target, string buildPath)
{
if (target == BuildTarget.iOS)
{
string path = Path.Combine(buildPath, "Podfile");
bool flag = File.ReadAllText(path).Contains("Unity-iPhone");//This is the line what has thrown the exception
using (StreamWriter streamWriter = File.AppendText(path))
{
if (!flag)
{
streamWriter.WriteLine("target 'Unity-iPhone' do");
streamWriter.WriteLine("end");
}
streamWriter.WriteLine("use_frameworks!");
}
}
}
This is the error stack trace.
FileNotFoundException: Could not find file "buildpath/Podfile".
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:232)
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:144)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)
System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize, System.Boolean checkHost) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/io/streamreader.cs:240)
System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/io/streamreader.cs:221)
System.IO.StreamReader..ctor (System.String path, System.Boolean detectEncodingFromByteOrderMarks) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/io/streamreader.cs:202)
System.IO.StreamReader..ctor (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/io/streamreader.cs:182)
(wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string)
System.IO.File.ReadAllText (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:550)
Facebook.Unity.Editor.XCodePostProcess.PostProcessBuild_iOS (UnityEditor.BuildTarget target, System.String buildPath) (at <9f12adda19004bfebbea312055e90c78>:0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:305)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:313)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/reflection/methodbase.cs:229)
UnityEditor.Build.BuildPipelineInterfaces+AttributeCallbackWrapper.OnPostprocessBuild (UnityEditor.BuildTarget target, System.String path) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:86)
UnityEditor.Build.BuildPipelineInterfaces.OnBuildPostProcess (UnityEditor.BuildTarget platform, System.String path, System.Boolean strict) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:325)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions)
XD.Build.Editor.BuildTool:GenericBuild() (at Assets/XD/Build/Editor/BuildTool.cs:492)
UnityEditor.EditorApplication:Internal_CallDelayFunctions()
Steps to Reproduce
Do not make a podfile before the order of PostProcessBuild(45)
as your building.
same problem , fixed it by : download the origion code, remove code, rebuild Facebook.Unity.Editor.dll file, and replace it , hope help you;;;
@KylinChang @KylinChang @TatsuyaPan
@zhangjianshuai From where can we find the original code for the post process?