title: Convert Dictionary to Base64: error Segmentation fault 11
body: <p>I am trying to create JSON Web Token using <code>JSONSerialization</code> class, Swift 3 and Xcode 8.1, but my project fails to build with error: </p>
  
  <blockquote>
    <p>Command failed due to signal: Segmentation fault 11. </p>
  </blockquote>
  
  <p>Anyone knows why my code is not correct?</p>
  
  <p>If I comment out this code from the project, the project builds. </p>
  
  <pre><code> let customerError = "Custom Error"
   enum headerError: Error {
   case customerError
   }
  
   let headerJWT: [Dictionary] = ["alg":"RS256","typ":"JWT"]
  
   //Convert headerJWT to Data
   do {
      let headerJWTData: Data = try? JSONSerialization.data(withJSONObject:headerJWT,options: JSONSerialization.WritingOptions.prettyPrinted) 
   } catch headerError.customerError {
          print("could not make data")
   }
  
   //Convert headerData to string utf8
   do {
      let headerJWTString = try String(data: headerJWTData,encoding:String.Encoding.utf8) as! String
   } catch {
       print("string could not be created")
   }
  
   //Convert headerJWTString to base64EncodedString
   do {
      let headerJWTBase64 = try Data(headerJWTString.utf8).base64EncodedString()
   } catch {
  "base64 could not be created"
   }
  </code></pre>