2016-08-25 3 views
0
NSData *myRequestData = [NSData dataWithBytes: [encryptedStr UTF8String] length: [encryptedStr length]]; 

위의 문자열을 Swift로 변환하고 싶습니다.Objective-C에서 Swift로 변환

var myRequestData = NSData(bytes: encryptedStr.UTF8String(), length: encryptedStr.length())! 

위의 내용을 시도했지만 Xcode 7.3.1에서 작동하지 않습니다.

https://objectivec2swift.com/#/home/main을 사용하여 변환하려고했으나 실패했습니다.

+0

당신이'엑스 코드에서 작동하지 않는 무엇을 의미합니까 시도 7.3.1'? 뭐가 문제 야? 이 정보로 질문을 업데이트하십시오. 위의 – Cristik

+0

은 내 Objective-c 코드이며 swift 용으로 변환하고 싶습니다. – ZetrixWeb

답변

0

는이

var myRequestData = NSData(bytes: (encryptedStr as NSString).UTF8String, length: encryptedStr.characters.count) 
+0

Thanks @Mahesh Verma – ZetrixWeb

+0

NSString * encVal = [ccTool encryptRSA : myRequestString key : rsaKey]; encVal = (는 NSString *) CFBridgingRelease (CFURLCreateStringByAddingPercentEscapes (NULL, (CFStringRef) encVal, NULL, (CFStringRef) @ '*'();!? @ & = + $/% # [] " kCFStringEncodingUTF8)); – ZetrixWeb

+0

이 변환도 가능합니까? – ZetrixWeb

관련 문제