string转NSSTring*

来源:互联网 发布:wifi有信号没网络 编辑:程序博客网 时间:2024/06/10 09:04
void My91LoginImplIOS::buyWithCooOrderSerial(string orderId){    this->myOrderId = orderId;    _my91Login->myOrderId = orderId;        //订单号productId    NSArray* productIdArray = [NSArray arrayWithObjects:                               @"115429-20140801-105232094-84",                               @"115429-20140728-194402904-98",                               @"115429-20140728-194723885-16",                               @"115429-20140728-194822884-58",                               @"115429-20140728-194909696-39",                               @"115429-20140728-195031058-12",                               @"115429-20140728-195115225-34",                               nil];        //                    NdBuyInfo* buyInfo = [[NdBuyInfo new] autorelease];    buyInfo.cooOrderSerial = [NSString stringWithUTF8String:orderId.c_str()];    buyInfo.productId = (NSString*)[productIdArray objectAtIndex:tag];    buyInfo.productName = [NSString stringWithUTF8String:getProductNameByTag(tag).c_str()];  //string 转化NSString*    buyInfo.productPrice = getGoodsPriceByTag(tag);    buyInfo.productOrignalPrice = getGoodsPriceByTag(tag);    buyInfo.productCount = 1;    buyInfo.payDescription = @"gamezoon1";        //发起购买请求    int res = [[NdComPlatform defaultPlatform] NdUniPayAsyn:buyInfo];    if(res < 0)    {        NSLog(@"输入参数有错!无法提交购买请求");    }}

切记注意字符串编码问题,不然会乱码.


0 0
原创粉丝点击