激活 iPhone通过 GPRS 连接服务器功能的代码
如果您的 iPhone 应用里含有连接服务器的功能,也许会遇到这种问题:WiFi 环境下连接正常,但用 GPRS 不能直接连接。因为纯 C 的 socket 不能激活 GPRS,而 Apple 自带的 API 可以。所以要使用 GPRS 连接功能,必须在程序启动时要运行一下这段代码-(void)activeGPRSThread
{
NSError *error;
NSURLResponse *response;
NSMutableURLRequest *request = ];
;
NSData* reData;
NSString* strData;
reData = ;
strData = [ initWithData:reData encoding:NSUTF8StringEncoding];
NSLog(@"%@",strData);
g_isGPRSThreadActive = NO;
}
页:
[1]