如何使printf的输出出现在Xcode Organizer控制台视图中?在连接设备上进行调试时,我可以在Xcode的调试控制台中的NSLog输出中看到printf输出,但我只能在Organizer控制台上看到NSLog输出.
我正在开发Objective-C++并使用printf来记录纯c ++代码.最终,我希望从设备断开连接时可以获得应用程序的输出.
这个问题专门针对 Unity3d IL2CPP 和 iOS。
使用反射调用泛型方法
class SourceValue<T> { public T value; }
class TargetValue<T> { public T value; }
static TargetValue<T> GenericMethod<T> (SourceValue<T> source) {
return new TargetValue<T> { value = source.value };
}
void Main () {
Type genericType = typeof(SourceValue<float>);
Type typeArg = genericType.GenericTypeArguments[0];
MethodInfo mi = GetType ().GetMethod ("GenericMethod", Flags | BindingFlags.Static);
MethodInfo gmi = mi.MakeGenericMethod (typeArg);
object src = new SourceValue<float> { value = 0.5f };
object trg = gmi.Invoke (this, new object[] { src …Run Code Online (Sandbox Code Playgroud)