问题
The problem is that I get a black screen after the splash screen ONLY when a class that inherits the PayPalPaymentDelegate.
At the first I thought it was my PayPalMobile binding so I used this PayPalMobile binding by Alejandro. I got the same results by using his binding and mine.
I ran Alejandro sample app and it works flawlessly. I have no idea why I'm getting the black screen on mine.
What could be causing this issue on my project?
What I have done so far:
I changed the deployment target from 8.4 to 9.2 and the main interface from none to LoginViewController and received the same issue.
Made a new solution, added my PayPalMobile binding and it worked.
The root view controller does show before going to a black screen.
So, something is causing the issue within the solution which I can't figure out what.
Environment:
I'm using the latest PayPalMobile
Using Xamarin Studio 5.10.2
Using iPhone 6s 9.2 simulator
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>
回答1:
Check the info.plist file and see if your project have something missing
回答2:
Okay I found the problem.
In AppDelegate, I defined the UIWindow inside the FinishedLaunching() method.
Making the UIWindow class as override, fixed the problem.
In 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;
}
}
来源:https://stackoverflow.com/questions/36539611/black-screen-after-displaying-root-view-controller-only-when-inheriting-paypalp