Preview Embedded Links in iOS App Like Facebook

后端 未结 2 1338
萌比男神i
萌比男神i 2021-02-05 18:48

I\'m trying to embed a link preview in an iOS application in the same way that Facebook does:

\"enter

2条回答
  •  -上瘾入骨i
    2021-02-05 19:22

    You can do this server-side or client-side.

    Server-side, you can use a script (like the one you've built) to grab the tag of the HTML page.

    Client-side you can download the whole page as HTML (as an example, Mashable is ~180KB) with NSURLConnection or a library like AFNetworking and parse it with a XML parser to find the tag.

    I suggest you to create a server script, so you can reuse it in other projects or other platforms.

提交回复
热议问题