Skip to content

Commit

Permalink
fix tvOS test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
iOS authored and iOS committed Mar 30, 2016
1 parent e6397f6 commit d5a63fa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Sources/TidyJSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -345,26 +345,26 @@ extension JSON {
/**
* parse JSON from string, return nil or valid JSON
*/
#if os(OSX) || os(iOS)
#if os(OSX) || os(iOS) || os(tvOS) || os(watchOS)
public static func parse(string: Swift.String) throws -> JSON {
if let data = string.data(usingEncoding: NSUTF8StringEncoding) {
return try parse(data)
return try parse(utf8: data)
}
return nil
}
#elseif os(Linux)
public static func parse(string: Swift.String) throws -> JSON {
if let data = string.dataUsingEncoding(NSUTF8StringEncoding) {
return try parse(data)
return try parse(utf8: data)
}
return nil
}
#endif

/**
* parse JSON from data buffer, return nil or valid JSON
* parse JSON from utf8 endcoded bytes data buffer, return nil or valid JSON
*/
public static func parse(data: NSData) throws -> JSON {
public static func parse(utf8 data: NSData) throws -> JSON {
let buffer = UnsafeBufferPointer(start: UnsafePointer<UInt8>(data.bytes), count: data.length)
var parser = Parser(buffer)
return try parser.parse().0
Expand Down

0 comments on commit d5a63fa

Please sign in to comment.