Sending SMS in iOS with Swift

后端 未结 7 754
一向
一向 2020-12-04 06:47

First of all, I\'m really surprised that this is not a duplicate, because there are TONS of stackoverflow questions that solve this in Objective-C, but I have yet to see a g

相关标签:
7条回答
  • 2020-12-04 07:23

    Simpler solution may be opening html link:

    let mPhoneNumber = "1111111111";
    let mMessage = "hello%20phone";
    if let url = URL(string: "sms://" + mPhoneNumber + "&body="+mMessage) {
        UIApplication.shared.open(url)
    }
    

    Make sure you replaced spaces with "%20"

    0 讨论(0)
提交回复
热议问题