IONIC STATE RESTORE不再有效

时间:2017-07-24 21:14:15

标签: ionic3

我试图恢复我的项目插件和包标识符, 但是这个命令不再起作用了:

@IBAction func addToContacts(_ sender: Any) {

    // Send Data to create a contact card
    let contact: CNContact = supportMethods.createContact(lastName: lastNameString, firstName: firstNameString, email: emailString, phone: agentContactPhone!, city: agentCity, title: "Agent", image: imageString, bio: bioScrollView)

        do {
            try shareContacts(contacts: [contact])
        } catch {
        }

}

class func createContact(lastName: String, firstName: String, email: String, phone: String, city: String, title: String, image: String, bio: String) -> CNContact {
    // Creating a mutable object to add to the contact
    let contact = CNMutableContact()

    contact.familyName = lastName
    contact.givenName = firstName
    contact.jobTitle = title
    contact.organizationName = "IDX Broker"
    contact.note = bio

    let imgURL = URL(string: image)
    if imgURL != nil {
        let data = NSData(contentsOf: (imgURL)!)
        // If the Agent has a phot
        if data != nil {
            contact.imageData = data! as Data
        }
    }

    contact.phoneNumbers = [CNLabeledValue(
        label:CNLabelWork,
        value:CNPhoneNumber(stringValue: phone))]

    let email = CNLabeledValue(label: CNLabelWork, value: email as NSString)
    contact.emailAddresses = [email]


    let homeAddress = CNMutablePostalAddress()
    homeAddress.city = city
    contact.postalAddresses = [CNLabeledValue(label:CNLabelHome, value:homeAddress)]


    return contact
}

新命令是什么?

1 个答案:

答案 0 :(得分:0)

新命令是

ionic state restore 

**如果你现在没注意到,你必须把

ionic cordova prepare
现在在所有命令前面

除了

ionic cordova

一个仍然有效:D