簡體   English   中英

ios快速發布圖像到linkedin

[英]ios swift post image to linkedin

我正在使用Swift 3和LinkedIn API將圖像發布到LinkedIn。

當我通過http URL發布圖像時,該代碼有效。 但是,當我使用包含iPhone上本地文件路徑的URL,NSURL或String時,不會傳輸圖像。

這是代表要傳遞的數據的代碼:

let parameters: Parameters = [
  "content": [
    "title": "Title",
    "description": "Description",
    "submitted-url": "https://www.google.com",
    "submitted-image-url": --- This parameter is the problem --
  ],
  "comment": "comment",
  "visibility": [
    "code": "anyone"
  ]
]

這是我用於“ submitted-image-url”的值:

  1. https://www.codeproject.com/KB/GDI-plus/ImageProcessing2/flip.jpg

    • 此工作-在網絡上引用URL
  2. “/private/var/mobile/Containers/Data/Application/9BFF81E8-DFE4-41EF-B25C-A82C79CF1708/tmp/yellopost.jpeg”

    • 將其用作字符串會將除圖像之外的所有數據發布到LinkedIn
  3. “文件:///private/var/mobile/Containers/Data/Application/9BFF81E8-DFE4-41EF-B25C-A82C79CF1708/tmp/yellopost.jpeg”

    • 這失敗了
  4. “ / private / var / mobile /容器/數據/應用程序/9BFF81E8-DFE4-41EF-B25C-A82C79CF1708/tmp/yellopost.jpeg”作為NSURL

    • 這失敗了

那么,如何參考iPhone上存儲的圖像?

提前致謝。

該API僅接受遠程URL。 否則后端將如何訪問映像?

例如:

{
  "comment": "Check out developer.linkedin.com!",
  "content": {
    "title": "LinkedIn Developers Resources",
    "description": "Leverage LinkedIn's APIs to maximize engagement",
    "submitted-url": "https://developer.linkedin.com",  
    "submitted-image-url": "https://example.com/logo.png"
  },
  "visibility": {
    "code": "anyone"
  }  
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM