2016-11-12 5 views
5

अपने आवेदन में एक अजीब त्रुटि है कि मैं किसी भी समाधान/फिक्स नहीं मिल सकता है। किसी कारण से, मैं एक ऐसे पते पर एक पता सहेजने में सक्षम हूं जो एक सामाजिक प्रोफ़ाइल (फेसबुक, ट्विटर, आदि) के साथ एकीकृत नहीं है। हालांकि, जब मैं अपने संपर्क है कि फेसबुक या ट्विटर के साथ एकीकृत किया गया है मैं एक अजीब बचाने त्रुटि मिलती है के लिए एक पता जोड़ने का प्रयास:बचत संपर्क पता

The operation couldn’t be completed. (CNErrorDomain error 500.) 

यहाँ है कि मैं उपयोग कर रहा हूँ कोड के कुछ है:

if mutableContact.isKeyAvailable(CNContactPostalAddressesKey) { 
     var postalAddresses = [CNLabeledValue<CNPostalAddress>]() 

     for address in self.contactAddresses { 
      let postalAddress: CNLabeledValue<CNPostalAddress> = CNLabeledValue(label: CNLabelOther, value: address) 
      postalAddresses.append(postalAddress) 
     } 

     mutableContact.postalAddresses = postalAddresses 
    } 

    let saveRequest = CNSaveRequest() 

    if isNewContact { 
     saveRequest.add(mutableContact, toContainerWithIdentifier: nil) 
    } else { 
     saveRequest.update(mutableContact) 
    } 

    do { 
     try contactStore.execute(saveRequest) 
    } catch let error as NSError { 
     print(error.localizedDescription) 
     let alertController = UIAlertController(title: "Failed to save/update contact!", message: "Unfortunatly, the app couldn't add or make modifications to your contact. Please try again or use the Contacts app to preform changes.", preferredStyle: .alert) 
     let cancelAction = UIAlertAction(title: "Okay", style: .cancel) { 
      action in 
      self.dismiss(animated: true, completion: nil) 
     } 
     alertController.addAction(cancelAction) 
     self.present(alertController, animated: true, completion: nil) 
    } 
+0

क्या आपने इस समस्या को ठीक किया? – Rendel

+0

@ रेन्डेल को अभी तक ऐप्पल से प्रतिक्रिया मिली है – Harish

उत्तर

1

ठीक है, इसलिए मुझे ऐप्पल से प्रतिक्रिया मिली है और यह व्यवहार इरादा है। डेवलपर्स को इस नीति उल्लंघन का पता लगाना चाहिए और फिर एक नया संपर्क बनाने की पेशकश करनी चाहिए और फिर दो संपर्कों को लिंक करना चाहिए।

+1

गा। क्या एक भयानक समाधान है। :) –

+1

@DuncanBabbage मुझे पता है कि यह मेरे लिए एक बग की तरह दिखता है हाहा – Harish

संबंधित मुद्दे