IOS13 CNMutableContact Bug [duplicate] - ios

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.

Related

EKEventViewController wont show Edit Button on iOS 13

i got a simple app where i want to present an event within an EKEventViewController.
// the button action which validates if the event store access is granted and presents the given alert if true
#IBAction func actionButtonShowPopover(_ sender: Any) {
eventStore.requestAccess(to: .event) { (granted, _) in
guard granted else { return }
let event = self.generateAndSaveEvent()
self.presentEventViewController(withEvent: event)
}
}
// creates and tries to save an sample even and returns it
private func generateAndSaveEvent() -> EKEvent {
let event = EKEvent(eventStore: eventStore)
event.title = "Event Title"
event.startDate = Date()
event.endDate = Date().addingTimeInterval(1800)
event.calendar = eventStore.defaultCalendarForNewEvents
do {
try eventStore.save(event, span: .thisEvent)
} catch(let error) {
print(error)
}
return event
}
// displays an EKEventViewController with our newly created event within an popover
private func presentEventViewController(withEvent event: EKEvent) {
DispatchQueue.main.async {
let eventVC = EKEventViewController()
eventVC.event = event
eventVC.allowsEditing = true
eventVC.modalPresentationStyle = .popover
eventVC.popoverPresentationController?.sourceView = self.buttonShowPopover
eventVC.popoverPresentationController?.sourceRect = self.buttonShowPopover.frame.offsetBy(dx: 0, dy: -10)
eventVC.popoverPresentationController?.backgroundColor = .white
eventVC.popoverPresentationController?.permittedArrowDirections = .up
self.present(eventVC, animated: false, completion: nil)
}
}
i created an event as shown in the code above and simply displaying it within the popover view controller. since ios 13 i got a different result:
iOS 12.4 with edit button
iOS 13 without edit button
is there any chance i'm missing changes from iOS12 -> iOS13?
thanks upfront - i'm grateful for any advice!
Edit button has moved to navigation bar in iOS 13. You need to present it without popover style.
In my app, that's been around for a while, I was experiencing the same problem with the edit button no longer appearing in iOS13. Unlike other users, my EKEventViewController was already wrapped in a navigation controller, so it wasn't that issue.
Several hours of going down rabbit holes, I've found a fix. Here's where the problems were occurring in my app:
Debugging just before opening the view, the EKEvent object I was trying to edit didn't have a value set for .eventIdentifier. Reading into this, it seems this property is lazy loaded, so not being able to retrieve the value here suggests the link between the EKEvent and the EKStore I used to fetch it has been lost somewhere in the application lifecycle. This is a change that been introduced somewhere along the iOS/Swift upgrade journey - I can't pin down the change that has caused this.
By accessing the EKEvent.eventIdentifier at the time I first retrieved the EKEvent, I now had this identifier for later use
Before presenting the EKEventViewController, I fetch a fresh copy of this event and use the fresh event in the controller:
let freshEvent = store.event(withIdentifier: staleEvent.eventIdentifier)
eventViewController.event = freshEvent

UITabBarController opens and turns into black Screen in iOS13

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.

ReplayKit RPBroadcastActivityViewController iPad

How do I present the RPBroadcastActivityViewController on iPads.
I am using the standard code to start a recording
RPBroadcastActivityViewController.load { [unowned self] (broadcastActivityViewController, error) in
// If an error has occurred, display an alert to the user.
if let error = error {
self.showAlert(message: error.localizedDescription)
return
}
// Present vc
if let broadcastActivityViewController = broadcastActivityViewController {
broadcastActivityViewController.delegate = self
// present
self.present(...
}
}
Works on iPhones but on iPads nothing is presented and the app kind of freezes. I have been checking out games on the app store that use this feature and I noticed the same problem.
E.g on the game Tower Dash nothing is presented when pressing the live stream button on iPads, it only works on iPhones.
I have been trying to play around with popover presentations but nothing seems to work.
Am I missing something?
UPDATE: This seems to be a bug. Even in apples own Swift Playground app this happens.
UPDATE2: Apple has actually responded to my bug report and told me that I need to present the View Controller on iPads as a popover like so
UIDevice.current.userInterfaceIdiom == .pad {
broadcastAVC.popoverPresentationController?.sourceView = view
broadcastAVC.popoverPresentationController?.sourceRect = CGRect(x: view.bounds.midX, y: view.bounds.midY, width: 0, height: 0)
broadcastAVC.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.init(rawValue: 0) // no arrow
}
However it still doesnt work for me. As I mentioned this happens on apples own Swift Playground app so it must be a bug.
Fixed:
I forgot to add this line in the code mentioned above
broadcastAVC.modalPresentationStyle = .popover
You are correct that Apple's demo app does not include this little detail, but it isn't a bug. This is what I use to get it to work on an iPad. iPads require a popover to present the view and a popover needs an anchor. I chose to anchor it to the leftBarButtonItem.
if let unwrappedPreview = preview {
unwrappedPreview.previewControllerDelegate = self
if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.phone {
self.present(unwrappedPreview, animated: true, completion: nil)
}
else {
unwrappedPreview.popoverPresentationController?.barButtonItem = self.navigationItem.leftBarButtonItem!
unwrappedPreview.modalPresentationStyle = UIModalPresentationStyle.popover
unwrappedPreview.preferredContentSize = CGSize(width: self.view.frame.width, height: self.view.frame.height)
self.present(unwrappedPreview, animated: true, completion: nil)
}
}
iOS 10.1 beta 2 still have the same problem.
For now, I found the only way to present a RPBroadcastActivityViewController on iPad is to present it on a trait collection's horizontal compact environment.
So you may need to tell your user switch to Split View mode before select a broadcast-supported app, then switch back to full screen. After back to full screen, you can use RPBroadcastController.startBroadcast(handler:) to start broadcast.

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.

Sending sms swift in simulator [duplicate]

This question already has an answer here:
Difficulty obtaining capability to SMS via MFMessageComposeViewController in the iPhone simulator
(1 answer)
Closed 7 years ago.
If it possible to simulate sending sms in iPhone Simulator. I am not expecting to really send sms, just to show sms sending panel.
This is my code:
if MFMessageComposeViewController.canSendText() {
let messageVC = MFMessageComposeViewController()
messageVC.messageComposeDelegate = self
messageVC.recipients = ["1111111111", "2222222222"]
messageVC.body = "hello phone"
self.presentViewController(messageVC, animated: true, completion: nil)
} else {
print("Not using messages")
It always just print "Not using messages". Can someone advice, am I doing something wrong?
Thanks!
No it is not possible to show sms sending panel in iOS simulator. You'll have to register for Apple's developer program and test that on the device.

Resources