0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Swiftで文字列に文字を追加する

Last updated at Posted at 2020-07-09

Google Books APIを使用する際、http通信になってしまいATS制限に引っかかったので対処法を備忘録として記しておきます。

#http -> https

var url = "http://www.google.com"

let insertIndex = url.index(previewLink.startIndex, offsetBy: 4)
url.insert(contentsOf: "s", at: insertIndexToPreviewLink)

print(url)  // "https://www.google.com"

別記

ATS制限には、Info.plistを編集を編集することでも対応できる。

#参考
Swiftで指定したindexに文字・文字列を挿入する方法
[iOS] ATS対応徹底攻略!対応策とInfo.plistより行うATSの設定値まとめ

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?