이 문제를 조금만 해결했지만 아무 것도 작동하지 않습니다. 필자는 주요 스토리 보드에 효과적으로 설치된 뷰 컨트롤러를 보유하고 있습니다. 해당보기 컨트롤러 내부에서 연락처 유형을 작업에 전달하는 특정 작업이 발생하는 경우IOS 스위프트 CNContactViewController 탐색 모음이 표시되지 않음 UICavigation 컨트롤러가 표시되지 않음
이 동작은 전달 된 연락처에 대한 새 연락처보기 컨트롤러를 열고 사용자가 CNContactViewController에 따라 대화 상대와 상호 작용할 수 있도록합니다. 사용자가 연락처로 작업을 완료하면 didCompleteWith 메서드로 인해 닫히지 만 실제로 연락처를 만들지 않고도 연락처 컨트롤러를 종료 할 방법이 없습니다. 다음은
navigationController.navigationBar.isTranslucent = true
방법 : 나는 navigationItems에 navigationItems에서 모든 것을 시도
//change to new contact screen
let con = CNMutableContact()
con.givenName = familyComponents[0]
con.familyName = familyComponents[1]
let newEmail = CNLabeledValue(label: "Personal", value: objectComponents[2]
as NSString)
con.emailAddresses.append(newEmail)
con.phoneNumbers.append(CNLabeledValue(
label: "Home", value: CNPhoneNumber(stringValue: objectComponents[3])))
let newScreen = CNContactViewController(forUnknownContact: con)
newScreen.message = "Made using app"
newScreen.contactStore = CNContactStore()
newScreen.delegate = self
newScreen.allowsActions = true
let navigationController = UINavigationController(rootViewController:
newScreen)
self.present(navigationController, animated: true, completion: nil)
은, 코드 행과의 투명도를 변경할 수 있기 때문에 탐색 모음이 있다는 것을 나에게 보인다 :
func contactViewController(_ viewController: CNContactViewController,
didCompleteWith contact: CNContact?) {
viewController.dismiss(animated: true, completion: nil)
inContact = false
}
func contactViewController(_ shouldPerformDefaultActionForviewController:
CNContactViewController, shouldPerformDefaultActionFor property:
CNContactProperty) -> Bool {
return false
}
나는이 문제를 너무 오랫동안 고민하고있다. 감사합니다.
해결 : 작동합니다. 이것은 사과 프레임 워크의 버그입니다. 이 문제를 해결하기 위해 Unknown Contact에서이 버그가없는 새 연락처로 전환했습니다. 새로운 코드의 부 :
let newScreen = CNContactViewController(forNewContact: con)
newScreen.delegate = self
let navigationController = UINavigationController(rootViewController: newScreen)
self.present(navigationController, animated: true, completion: nil)
감사
으로 시도 할 수 있습니다? –
완료하기 전에 탐색 바를 표시하지 않고 완료 외에도 다른 방법을 취소해야합니다. – shuson