Digital Developer Conference: a FREE half-day online conference focused on AI & Cloud – North America: Nov 2 – India: Nov 9 – Europe: Nov 14 – Asia Nov 23 Register now

Close outline
  • United States
IBM?
  • Site map
IBM?
  • Marketplace

  • Close
    Search
  • Sign in
    • Sign in
    • Register
  • IBM Navigation
IBM Developer Answers
  • Spaces
    • Blockchain
    • IBM Cloud platform
    • Internet of Things
    • Predictive Analytics
    • Watson
    • See all spaces
  • Tags
  • Users
  • Badges
  • FAQ
  • Help
Close

Name

Community

  • Learn
  • Develop
  • Connect

Discover IBM

  • ConnectMarketplace
  • Products
  • Services
  • Industries
  • Careers
  • Partners
  • Support
10.190.13.195

Swift×

Refine your search by using the following advanced search options.

Criteria Usage
Questions with keyword1 or keyword2 keyword1 keyword2
Questions with a mandatory word, e.g. keyword2 keyword1 +keyword2
Questions excluding a word, e.g. keyword2 keyword1 -keyword2
Questions with keyword(s) and a specific tag keyword1 [tag1]
Questions with keyword(s) and either of two or more specific tags keyword1 [tag1] [tag2]
To search for all posts by a user or all posts with a specific tag, start typing and choose from the suggestion list. Do not use a plus or minus sign with a tag, e.g., +[tag1].
  • Ask a question

Watson texttospeech Code=400 No JSON object could be decoded - no sound played by app

120000A8R5 gravatar image
Question by vralh@au1.ibm.com  (46) | Mar 08, 2016 at 12:36 AM watsontext-to-speechiosswift

Using Swift IoS SDK - https://github.com/watson-developer-cloud/ios-sdk Can't get the example to work and can't figure it out.

Get the following error message:

Optional(Error Domain=com.watsonplatform.texttospeech Code=400 "No JSON object could be decoded" UserInfo={NSLocalizedDescription=No JSON object could be decoded, NSLocalizedFailureReason=Bad Request})

Code is as follows: (removed credentials)


// // ViewController.swift // watsonspeaks // // Created by Vinod Ralh on 6/03/2016. // Copyright © 2016 Vinod Ralh. All rights reserved. //

import UIKit import WatsonDeveloperCloud

class ViewController: UIViewController { var player: AVAudioPlayer? override func viewDidLoad() {

     super.viewDidLoad()
     
     let tts = TextToSpeech(username: "xxxxxxxxx", password: "xxxxxxxxx")
     tts.synthesize("All the problems of the world could be settled easily if men were only willing to think.") {
         
         data, error in
         
         if let audio = data {
             
             do {
                 self.player = try AVAudioPlayer(data: audio)
                 self.player!.play()
             } catch {
                 print("Couldn't create player.")
             }
             
         } else {
             print(error)
         }
         
         
     }
     
 }

}

teddyLemonade

People who like this

  1
Comment
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster

2 answers

  • Sort: 
310000VN4F gravatar image

Answer by Glenn R. Fisher (196) | Mar 10, 2016 at 03:14 PM

Hi Vinod. Thanks for posting this error! We're tracking it as a Github issue and pull request. We expect to merge/publish a fix shortly. Please check there for the latest information. Thanks!

Comment

People who like this

  0   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
310000VN4F gravatar image

Answer by Glenn R. Fisher (196) | Mar 19, 2016 at 03:55 AM

The pull request mentioned above fixed this issue in version 0.1.2 of the iOS SDK. To update to the most recent version of the iOS SDK, navigate to your project directory in the terminal and execute carthage update --platform iOS.

Hope that helps! Thanks.

Comment

People who like this

  0   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster

Follow this question

66 people are following this question.

Answers

Answers & comments

Related questions

Watson Swift Ios SDK Text to Speech console msg - No JSON object could be decoded 3 Answers

How to display charts to users using Conversation service 0 Answers

Using the the Text to speech Service in an iOS Cordova App 3 Answers

DB2 iOS (Swift 4) Integration 1 Answer

Watson Assistant and Swift 1 Answer

  • Contact
  • Privacy
  • IBM Developer Terms of use
  • Accessibility
  • Report Abuse
  • Cookie Preferences

Powered by AnswerHub

Authentication check. Please ignore.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • API Connect
  • Analytic Hybrid Cloud Core
  • Application Performance Management
  • Appsecdev
  • BPM
  • Blockchain
  • Business Transaction Intelligence
  • CAPI
  • CAPI SNAP
  • CICS
  • Cloud Analytics
  • Cloud Automation
  • Cloud Object Storage
  • Cloud marketplace
  • Collaboration
  • Content Services (ECM)
  • Continuous Testing
  • Courses
  • Customer Experience Analytics
  • DB2 LUW
  • Data and AI
  • DataPower
  • Decision Optimization
  • DevOps Build
  • DevOps Services
  • Developers IBM MX
  • Digital Commerce
  • Digital Experience
  • Finance
  • Global Entrepreneur Program
  • Hadoop
  • Hybrid Cloud Core
  • Hyper Protect
  • IBM Cloud platform
  • IBM Design
  • IBM Forms Experience Builder
  • IBM Maximo Developer
  • IBM StoredIQ
  • IBM StoredIQ-Cartridges
  • IIDR
  • ITOA
  • InformationServer
  • Integration Bus
  • Internet of Things
  • Kenexa
  • Linux on Power
  • LinuxONE
  • MDM
  • Mainframe
  • Messaging
  • Node.js
  • ODM
  • Open
  • PartnerWorld Developer Support
  • PowerAI
  • PowerVC
  • Predictive Analytics
  • Product Insights
  • PureData for Analytics
  • Push
  • QRadar App Development
  • Run Book Automation
  • Search Insights
  • Security Core
  • Storage
  • Storage Core
  • Streamsdev
  • Supply Chain Business Network
  • Supply Chain Insights
  • Swift
  • UBX Capture
  • Universal Behavior Exchange
  • UrbanCode
  • WASdev
  • WSRR
  • Watson
  • Watson Campaign Automation
  • Watson Content Hub
  • Watson Marketing Insights
  • dW Answers Help
  • dW Premium
  • developerWorks Sandbox
  • developerWorks Team
  • Watson Health
  • More
  • Tags
  • Questions
  • Users
  • Badges