问题
Here are the sequence of events which cause my app to return a black screen:
1.) I select a button on my website via the app's UIWebView that allows me to change my profile picture.
2.) The app pulls up the three standard options from the bottom of the screen: "Take Photo or Video", "Choose Existing", "Cancel"
3.) If I choose either of the first two options and then choose or take a photo, my app returns to display a black screen. The profile picture is not changed. I also notice that the following message appears in the console window: "Unbalanced calls to begin/end appearance transitions for UIFileUploadFallbackRootViewController: 0x1c590e60."
The strange part is that this mobile website 'load photo' feature used to work when accessed from my app's UIWebView. I first noticed this issue after upgrading to iOS6. Any ideas on what may have changed or what I now need to accommodate from my website or app?
Thanks in advance for any help you can offer!
2/17/13 Update:
HTML Code on mobile website for loading photos:
<form class="appnitro" enctype="multipart/form-data" method="post" action="mysite.php">
<input id="file1" name="file1" class="button_text" type="file" size="50px"/> <br />
<input id="submitpic" class="button_text" type="submit" name="submit" value="Save Picture" />
</form>
Note: Using jquery mobile. Also, if Safari is used to access the mobile website, the upload photo feature works fine. The black screen is only displayed when attempting to use the UIWebView from within the app to upload a new photo.
回答1:
It appears to be because the rootViewController is not set.
You probably have a warning: "Application windows are expected to have a root view controller at the end of application launch"
Make sure you have something like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after app launch
_window.rootViewController = myViewController;
...
}
来源:https://stackoverflow.com/questions/14667023/xcode-io6-uiwebview-returns-black-screen-after-returning-from-choosing-a-photo