UIDocumentPicker can not display Browse at iOS 11 - ios

I wrote a program of UIDocumentPicker.
However, if I tap "Browse" on the iOS 11 simulator, loading continues to be displayed and could not be displayed.
What kind of response is necessary?
Development environment
Xcode: Version 9.0 beta 5
Simulator: iPhone 7 Plus (iOS 11.0)
Error Image
Code
https://github.com/amarron1/SampleDocumentPicker
class ViewController: UIViewController, UIDocumentPickerDelegate {
let UTIs:[String] = ["public.data"]
// Save to this application from iCloud
#IBAction func importDocumentPicker(_ sender: Any) {
let importPicker = UIDocumentPickerViewController(documentTypes: self.UTIs, in: .import)
importPicker.delegate = self
present(importPicker, animated: true, completion: nil)
}
}
Log
2017-09-06 11:37:54.790680+0900 SampleDocumentPicker[40282:5448334] Unbalanced calls to begin/end appearance transitions for <_UIWaitingForRemoteViewContainerViewController: 0x7fb54c6153b0>.
2017-09-06 11:38:04.101520+0900 SampleDocumentPicker[40282:5448334] [DocumentManager] The view service did terminate with error: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}

By the looks of it, this is a simulator-only issue. (iOS 11.0 simulator)
UIDocumentPicker works ok on devices.
If anyone encounters this problem, just test on a real device.

Related

MFMailComposeViewController is buggy on iOS 14

I recently found out that MFMailComposeViewController behaves buggy when entering the recipient email, it causes a loop going in the view as shown in the GIF below: Bug
My implementation of MFMailComposeViewController is pretty standard:
if MFMailComposeViewController.canSendMail() {
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
mail.setSubject("Report an issue")
mail.setMessageBody("", isHTML: true)
present(mail, animated: true)
} else {
}
I have not been able to replicate this on iOS 14.6 but other users were able to replicate this behavior. They have iOS 14.3 and 14.4 on iPhone X. I think it has something to do with the iOS version or the specific iPhone model.
Is there any way I can use the simulator to debug MFMailComposeViewController functionality? Even removing canSendMail(), I can't seem to make it works with the simulator.

Is Sign in with Apple (SIWA) supported in the tvOS simulator?

I have enabled the entitlements for SIWA in the project target. And the same steps are working fine in the iOS simulator.
I am facing the following issue while trying to Sign in with Apple (SIWA) on the tvOS simulator.
Steps to reproduce the issue:
Upon requesting for SIWA on custom button tap, a full-screen layover displayed for the password of apple id (No option for choosing email relay was given) (screenshot attached in the last for reference)
Upon entering the correct password I get the callback in the error delegate.
Error in the error delegate:
error Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1000 "(null)"
Below is the code-snippet attached for the whole process.
I have done all the steps required as per the official document of SIWA for iOS.
FYI: The same code is working for iOS for me but not for the tvOS. I have tested SIWA in the iPhone simulator while development and now trying the same with the tvOS but it isn't working.
Below is my code.
Here, function setup( ) is called on viewDidLoad of ViewController
private func setup() {
if #available(tvOS 13.0, *) {
let appleIDProvider = ASAuthorizationAppleIDProvider()
appleIDProvider.getCredentialState(forUserID: "myapp.identifiers.currentUserIdentifier") { (credential, error) in
switch credential {
case .authorized:
print("authorized for sign in")
break
case .notFound, .revoked, .transferred:
print("ready to logout")
break
default:
print("Apple sign in credential state unidentified")
}
}
}
}
Inside the action method of the custom SIWA button, my code looks like
if #available(tvOS 13.0, *) {
let appleIDProvider = ASAuthorizationAppleIDProvider()
let request = appleIDProvider.createRequest()
request.requestedScopes = [.fullName, .email]
let authorizationController = ASAuthorizationController(authorizationRequests: [request])
authorizationController.delegate = self
authorizationController.presentationContextProvider = self
authorizationController.performRequests()
}
The presentation anchor is set in the extension of ViewController
extension ENWelcomeScreenViewController: ASAuthorizationControllerPresentationContextProviding {
#available(tvOS 13.0, *)
func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor {
return self.view.window!
}
}
And finally, the error delegate, in which I am receiving the callback.
/// - Tag: did_complete_error
#available(tvOS 13.0, *)
func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error) {
print("error \(error)")
}
Here is how it looks when the user taps on SIWA button.
Any leads are highly appreciated.
The answer to my question is a big no!!
FINDINGS:
We can not test the sign in with apple in the tvOS simulator.
When I tried running the same on Apple TV it worked.
After entering the apple id credentials to sign-in in my app I get the push notification on the device I am signed-in with the same apple id.
Nothing happens when you tap on the received push notification.
On the Apple forum, I get a similar response from their engineering team.
Here is a screen capture of Apple TV.
Just had the same issue. The simple solution is to take the term "nearby" more than literally. Hold your phone really close to the Apple TV when tapping the notification and everything will do its magic.

ReplayKit - finishBroadcastWithError not working

I have in my application Broadcast Upload extension. In broadcastStarted method I would like to, check does user is logged into my app. I've found how to do it in Apple WWDC presentation, but this resolve not works. Application does not streaming, but status bar showing that App still streaming. Here is my code:
override func broadcastStarted(withSetupInfo setupInfo: [String : NSObject]?) {
let condition = User.isLogged() // THIS IS FALSE
if(condition){
Uploader.startBroadcast(to: "demoChannel1")
}
else{
let userInfo = [NSLocalizedFailureReasonErrorKey: "Not Logged In"]
let error = NSError(domain: "RPBroadcastErrorDomain", code: 401, userInfo: userInfo)
finishBroadcastWithError(error)
print("User is not logged")
}
}
In console I can see message "User is not logged" but I see in status bar something like this
I have checked it in iPhone 8 Plus and iPhone 8 (iOS versions 13.4 and 13.3.1)
I will be grateful for any help

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

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