UITabBarController opens and turns into black Screen in iOS13 - ios

I have a application flow
first presentviewController -> pushViewController -> PushViewController -> click button action Showing TabBarContorller which in .present(manner)
DispatchQueue.main.async {
let tabBarController = TabBarController.instantiate()
tabBarController.modalPresentationStyle = .overFullScreen
self.present(tabBarController, animated: true)
}
Application works fine in iOS 11. When running on iOS 13 its show black Screen
Well I guess if you present of push and then present I guess this make no difference with the application.
Your Inputs are highlight appreciated
Thanks in advance.

Related

MFMailComposeViewController behaves differently in iOS 13 simulator and device

I'm trying to display MFMailComposeViewController in an app.
if MFMailComposeViewController.canSendMail() {
let mailComposeViewController = MFMailComposeViewController()
mailComposeViewController.navigationBar.tintColor = .white
mailComposeViewController.mailComposeDelegate = self
mailComposeViewController.setToRecipients(["support#gmail.com"])
mailComposeViewController.setSubject("Feedback")
present(mailComposeViewController, animated: true)
} else {
print("This device is not configured to send email. Please set up an email account.")
}
In iOS 12, it shows up without an issue. In both simulator and device.
But when I run the same project on a device running iOS 13, it looks like this.
The navigation bar color is gone. Also the send button is also invisible.
So I added mailComposeViewController.navigationBar.backgroundColor = .mv_primary but it still doesn't show on the device. Strangely the background color shows in the simulator.
However there's a strange behavior. The MFMailComposeViewController immediately dismisses by itself when I run it in the simulator.
The following error also shows up in the Xcode console.
[Common] [FBSSystemService][0x5f27] Error handling open request for
com.apple.MailCompositionService: {
userInfo = {
FBSOpenApplicationRequestID = 0x5f27;
}
underlyingError = ; } 2019-11-01
14:40:05.214158+0530 MailCompose[11289:262267] [Assert] Connection
request invalidated without resuming our _serviceSessionConnection.
This is an error. 2019-11-01 14:40:05.216901+0530
MailCompose[11289:262054] [General] #CompositionServices
_serviceViewControllerReady: NSError Domain=_UIViewServiceInterfaceErrorDomain Code=0
I guess the weird dismiss error is a Xcode bug. But how do I fix the background color and the send button not showing up in the device?
This is how I set all the navigationbar related styles.
UINavigationBar.appearance().barTintColor = .mv_primary
UINavigationBar.appearance().tintColor = .white
UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
if #available(iOS 11.0, *) {
UINavigationBar.appearance().largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
}
Demo project
Add this line of code before present it. It will work normal. This a change in iOS 13
mailController.modalPresentationStyle = .fullScreen
The reason why the Mail composer dismisses immediately is because you can't actually send an email from the simulator. The implementation is different from iOS itself.
What I guess is happening here is that while the simulator implementation uses just some normal UI elements, the MFMailComposeViewController on native iOS is actually hosted like UIDocumentPickerViewController or UIActivityViewController. This means screenshots and trying to traverse the view tree is impossible, because the view is not an actual part of your application. They do that because these controllers contain user private information. Hosted view controller do NOT allow for customization, and do not comply with your global UINavigationBar.appearance(). This would explain why it does show up in the simulator and not on your native device.
This is new UI Style from iOS 13. You can disable it in Storyboard or set manual.
Presenting modal in iOS 13 fullscreen

IOS13 CNMutableContact Bug [duplicate]

This question already has answers here:
Keyboard overlaying action sheet in iOS 13.1 on CNContactViewController
(7 answers)
Closed 3 years ago.
I just try to call function with below code
func bugVersionPressed() {
let contact = CNMutableContact()
contact.familyName = "aaaa"
contact.givenName = "aaaa"
contact.organizationName = "bbbb"
let addContactVC = CNContactViewController(forNewContact: contact)
let navController = UINavigationController(rootViewController: addContactVC)
navController.view.backgroundColor = .red
navController.modalPresentationStyle = .fullScreen
self.present(navController, animated: true, completion: nil)
}
But the apple seems havent handle keyboard dismiss problem, I CAN'T DISMISS THE KEYBOARD AND I CAN'T GO BACK TO THE HOME PAGE BY PRESS "Cancel"
PIC1 : (Before present to CNContactViewController)
PIC2 : (Bug Case, Keyboard Cannot dismiss)
PIC3 : (Wish Case, Keyboard Dismiss while Clicked "Cancel")
In case I found a AppleStore App https://apps.apple.com/cn/app/%E5%BE%AE%E5%95%86%E5%8A%A0%E7%B2%89%E5%AE%9D-%E5%85%8D%E6%B3%A8%E5%86%8C%E6%B7%BB%E5%8A%A0%E6%B4%BB%E7%B2%89-%E8%81%94%E7%B3%BB%E4%BA%BA%E5%A5%BD%E5%8F%8B%E8%87%AA%E5%8A%A8%E7%94%9F%E6%88%90/id475661774 but same problem. Please tell me what can I do. Many thanks.
The problem doesn't occur in iOS 13, but in iOS 13.1.
I think this is a problem with the CNContactViewController, not CNMutableContact.
I'm sorry, but I don't know how to avoid it because of Apple's framework.
Send a bug report to Apple.

Swift pushViewController Works on iPad but not iPhone

I have no idea what is happening but my code stopped working on iPhone but works fine on iPad. (Using Xcode 10 and Swift 4)
I first check for the data and if not set it transfers to the ConfigVC.
Nothing happens on the simulator for any phone settings. I went so far as to reinstall my system software and Xcode.
I use this same approach on other apps and it is fine. For some strange reason it just stopped working on this app.
func dataCheck(){
// make sure the required data is set
if User.getInfo() == nil || Index.getAll() == nil {
let vc = UIStoryboard.init(name: "Config", bundle: Bundle.main).instantiateViewController(withIdentifier: "ConfigVC") as? ConfigVC
self.navigationController?.pushViewController(vc!, animated: true)
}
}
The code shows it just ending.
You're trying to push/present a vc while the current isn't yet loaded inside viewDidLoad so move the call to dataCheck inside viewWillAppear/viewDidAppear

Different UI for iPad and iPhone

In my app I have browser and UI for iPad and iPhone should be different.
I don't use storyboards and write all programmatically.
Also, when user taps on "downloadsButton", there will be different behavior.
On iPhone a new controller with full screen size will appear from bottom, but on iPad a little square view will appear in the center of screen.
How can I do this properly ?
iPhone
iPad
Let's say you touch downloadButton to invoke downloadAction, then you may try to change the modalPresentationStyle (of the view controller you want to show) doing so:
func downloadAction() {
let downloadVc = DownloadViewController()
downloadVc.modalPresentationStyle = UIDevice.current.userInterfaceIdiom == .pad ? .formSheet : .fullScreen
self.present(downloadVc, animated: true, completion: nil)
}

MPMediaPickerController shows an empty screen on iOS10

I am trying to port my apps to iOS 10, including the visualization of a MPMediaPickerController by means of the following code:
#IBAction func handleBrowserTapped(_ sender: AnyObject){
let pickerController = MPMediaPickerController(mediaTypes: .music)
pickerController.prompt = NSLocalizedString("Add pieces to queue", comment:"");
pickerController.allowsPickingMultipleItems=true;
pickerController.delegate=MPMusicPlayerControllerSingleton.sharedController();
self.present(pickerController, animated:true, completion:{
MPMusicPlayerControllerSingleton.sharedController().storeQueue()
})
}
Yet all that appears on the screen is a full white screen with no back buttons or other, differently from the previous iOS versions. The block is called and so the picker's presentation seems to succeed. What could be the problem?
Add Key-value to Plist :
<key>NSAppleMusicUsageDescription</key>
<string>$(app Name) uses music</string>
The issue was fixed by the latest beta now asking for an authorisation to access the iTunes library.

Resources