我正在使用证书和私钥
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', $certfile);
stream_context_set_option($ctx, 'ssl', 'passphrase', $pass);
$fp = stream_socket_client('ssl://gateway.xyz.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);
Run Code Online (Sandbox Code Playgroud)
它在我的本地XAMPP服务器上运行,但它不能在外部服务器上运行:
警告:stream_socket_client()[function.stream-socket-client]:无法连接到/home/biranchi/public_html/push.php中的ssl://gateway.sandbox.push.apple.com:2195(连接超时)在第42行
无法连接110
错误是什么?我是否需要更改服务器中的某些设置?
这是我在AppDelegate类中的代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = 1000; // 1 Km
locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;
[locationManager startUpdatingLocation];
}
Run Code Online (Sandbox Code Playgroud)
这是我在AppDelegate类中的委托方法
//This is the delegate method for CoreLocation
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
//printf("AppDelegate latitude %+.6f, longitude %+.6f\n", newLocation.coordinate.latitude, newLocation.coordinate.longitude);
}
Run Code Online (Sandbox Code Playgroud)
它工作在3.0,3.1,3.1.3,但它不适用于4.0模拟器和设备.
是什么原因 ?
我将UITabBarController添加到窗口,并将UITabBarController的viewControllers属性设置为ViewControllers数组.如果我在viewController中设置徽章值,那么它的工作正常.self.tabBarItem.badgeValue = @"3";
但是,如果我将UITabBarController的viewControllers属性设置为具有视图控制器作为rootviewcontroller的导航控制器数组,那么它不设置徽章值.
有什么建议 ??
谢谢
我正在从NSURLConnection类的服务器下载一些非常大的数据.
如何实现暂停功能以便我可以继续下载?
我正在使用AudioToolBox播放一个小的.wav文件.
AudioServicesPlaySystemSound (soundFileObject);
Run Code Online (Sandbox Code Playgroud)
但有时它不会播放.
是什么原因?
这2个案例中哪一个在创建文件方面更快?
Case 1:
======
NSData *data = [Some data];
[data writeToFile:filePath atomically:YES];
Case 2:
=======
NSFileManager *fileManager = [NSFileManager defaultManager];
[fileManager createFileAtPath:filePath contents:data attributes:nil];
Run Code Online (Sandbox Code Playgroud)
谢谢Biranchi.
objective-c ×4
iphone ×3
php ×2
audiotoolbox ×1
cllocation ×1
cocoa ×1
cocoa-touch ×1
file ×1
geoip ×1
nsdata ×1
nsurlrequest ×1
sockets ×1
stream ×1
uikit ×1
uitabbaritem ×1