Create New Post

116 views
Skip to first unread message

Hiren Gohel

unread,
Feb 3, 2018, 2:19:46 AM2/3/18
to tumbl...@googlegroups.com
Hello All,

I want to share image and video on tumblr using my application, So anyone done this is swift please help me.

let request : TMRequestFactory = TMRequestFactory(baseURLDeterminer: TMBasicBaseURLDeterminer.init())

let client : TMAPIClient = TMAPIClient(session: self.session!, requestFactory: request)

let task : URLSessionTask = client.postDataTask(withBlogName: "SamplePost", type: "text", parameters: ["title" : "My data", "body" : "this is my sample post please check it is post or not"]) { (data, response, error) in

    if (error != nil)

    {

        print(error!)

    }

    else

    {

        print("Success")

    }

}


task.resume()


i create above code for create new post it give success but not display on my post list.

Michael Ceyko

unread,
Feb 5, 2018, 4:45:08 PM2/5/18
to Tumblr API Discussion
Hi Hiren,

Not being too familiar with Obj-C or Swift myself, this may not be the right solution, but there's two things you may want to try:

1. Make sure that you're actually using the correct blog name. Your sample use "SamplePost", which I'm assuming is not in your actual code -- but wanted to confirm this as well.
2. Try checking the response code instead of relying only on `error`. Any http response code in the 400-599 range means that the request has failed. You should get a 201 response on success in creating a new post.

If neither of these approaches works, can you please open an issue directly on TMTumblrSDK instead? This mailing list is more general purpose, but any client-specific questions can probably be better answered on the github project page itself.

Regards,
Mike
Reply all
Reply to author
Forward
0 new messages