I am using Swift 3 and the LinkedIn APIs to post an image to LinkedIn.
The code works when I post an image via an http URL. But, the image is not transferred when I use a URL, NSURL, or String that contains the path to a local file on my iPhone.
Here is the code that represents the data being passed:
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"
]
]
Here are the values I have used for "submitted-image-url":
"https://www.codeproject.com/KB/GDI-plus/ImageProcessing2/flip.jpg"
- THIS WORKED - referencing a URL on the web
"/private/var/mobile/Containers/Data/Application/9BFF81E8-DFE4-41EF-B25C-A82C79CF1708/tmp/yellopost.jpeg"
- Using this as a String posts all the data to LinkedIn, except the image
"file:///private/var/mobile/Containers/Data/Application/9BFF81E8-DFE4-41EF-B25C-A82C79CF1708/tmp/yellopost.jpeg"
- This fails
"/private/var/mobile/Containers/Data/Application/9BFF81E8-DFE4-41EF-B25C-A82C79CF1708/tmp/yellopost.jpeg" AS AN NSURL
- This fails
So, how do I reference an image stored on the iPhone?
Thanks in advance.