显示根视图控制器后的黑屏,只有在inheritancePayPalPaymentDelegate时

问题是, 只有在inheritance了PayPalPaymentDelegate的类时,才会在启animation面后显示黑屏。

在第一次,我认为这是我的PayPalMobile绑定,所以我用这个由Alejandro PayPalMobile绑定 。 我通过使用他的绑定和我得到了相同的结果。

我运行Alejandro示例应用程序 ,它完美的作品。 我不知道为什么我要弄到我的黑屏。

什么可能导致我的项目这个问题?

我到目前为止所做的:

我将部署目标从8.4更改为9.2,将主界面从none更改为LoginViewController,并收到相同的问题。

做了一个新的解决scheme,添加了我的PayPalMobile绑定,它的工作。

在进入黑屏之前,根视图控制器会显示出来。

所以,有些东西在解决scheme中导致了我无法弄清楚的问题。

环境:

我正在使用最新的PayPalMobile

使用Xamarin Studio 5.10.2

使用iPhone 6s 9.2模拟器

的Info.plist

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDisplayName</key> <string>Test</string> <key>CFBundleShortVersionString</key> <string>1.0</string> <key>CFBundleVersion</key> <string>1.0</string> <key>LSRequiresIPhoneOS</key> <true/> <key>MinimumOSVersion</key> <string>9.2</string> <key>UIDeviceFamily</key> <array> <integer>1</integer> </array> <key>UILaunchStoryboardName</key> <string>LaunchScreen</string> <key>UIRequiredDeviceCapabilities</key> <array> <string>armv7</string> </array> <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> </array> <key>UIStatusBarStyle</key> <string>UIStatusBarStyleLightContent</string> <key>CFBundleIconFiles</key> <array> <string>Icon</string> </array> <key>UIBackgroundModes</key> <array> <string>location</string> </array> <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string>MKDirectionsRequest</string> <key>LSItemContentTypes</key> <array> <string>com.apple.maps.directionsrequest</string> </array> </dict> </array> <key>MKDirectionsApplicationSupportedModes</key> <array> <string>MKDirectionsModeCar</string> </array> <key>XSLaunchImageAssets</key> <string>Resources/Images.xcassets/LaunchImage.launchimage</string> <key>CFBundleIdentifier</key> <string>email@yahoo.com</string> <key>UIMainNibFile</key> <string>LoginViewController</string> </dict> </plist> 

检查info.plist文件,看看你的项目是否有缺失

好的,我发现了这个问题。

在AppDelegate中,我在FinishedLaunching()方法中定义了UIWindow。

使UIWindow类成为覆盖,解决了这个问题。

在AppDelegate中:

 public partial class AppDelegate : UIApplicationDelegate { // This fixed the problem public override UIWindow Window { get; set; } public override bool FinishedLaunching (UIApplication app, NSDictionary options) { //This cause the black screen //UIWindow Window = new UIWindow (UIScreen.MainScreen.Bounds); Window = new UIWindow (UIScreen.MainScreen.Bounds); UINavigationController navController = new UINavigationController (new ViewController ()); Window.RootViewController = navController; Window.MakeKeyAndVisible(); return true; } }