小编Tec*_*tic的帖子

Android位置管理器,获取GPS位置,如果没有GPS,则转到网络提供商位置

我使用下面给出的代码来获取位置:

public Location getLocation() {
        try {
            mLocationManager = (LocationManager) context.getSystemService(LOCATION_SERVICE);

            // getting GPS status
            boolean isGPSEnabled = mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);

            // getting network status
            boolean isNetworkEnabled = mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);

            if (!isGPSEnabled && !isNetworkEnabled) {
                // no network provider is enabled
            } else {
                // First get location from Network Provider
                if (isNetworkEnabled) {
                    mLocationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER,  MIN_TIME_BW_UPDATES,  MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
                    Log.d("Network", "Network");
                    if (mLocationManager != null) {
                        location = mLocationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
                        if (location != null) {
                            lat = location.getLatitude();
                            lng = location.getLongitude();
                        }
                    }
                } …
Run Code Online (Sandbox Code Playgroud)

gps android android-location

30
推荐指数
2
解决办法
10万
查看次数

Xcode 5,将项目导出到SVN存储库

在Xcode的早期版本中,管理器中有一个存储库部分,现在Xcode 5中缺少该部分.如何在Xcode 5中将项目导出到SVN.

xcode xcode5

19
推荐指数
1
解决办法
3万
查看次数

更改版本号并在Xcode 5中构建

我已将Xcode升级到Xcode 5.从哪里可以更改现在在Target Summary中看不到的版本和内部版本号?

在此输入图像描述

iphone ios xcode5

14
推荐指数
2
解决办法
2万
查看次数

iPhone corebluetooth中央管理器向外设发送数据

我想将数据从iPhone发送到蓝牙设备,然后发现并连接.我指的是这个教程连接.

我无法将数据发送到与外部附件框架连接的外部蓝牙设备.

我正在使用iPhone5,因为它有蓝牙4.0

xcode ios core-bluetooth iphone-5 xcode5

12
推荐指数
2
解决办法
1万
查看次数

以编程方式从UITabBarController中选择选项卡并加载视图

我在加载所选标签项的视图时遇到问题.

我正在使用下面的代码中的viewDidLoadUIViewController1项UITabBar.

UITabBarController *tab = self.tabBarController;

if (tab){
   NSLog(@"I have a tab bar");
   [self.tabBarController setSelectedIndex:1];
   [self.tabBarController.view setNeedsDisplay];
   self.tabBarController.selectedIndex=1;
} else {
    NSLog(@"I don't have");
}
Run Code Online (Sandbox Code Playgroud)

当我按下返回选项卡控制器按钮时,它会选择选项卡但不会打开所需的视图.它显示了索引0处的选项卡视图.

在此输入图像描述

iphone uitabbarcontroller

3
推荐指数
1
解决办法
2472
查看次数

当应用程序在前台时,IOS Play Sound接收推送通知

如何在应用程序处于前台状态时接收推送通知时播放声音.

我的代码:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
    if (application.applicationState == UIApplicationStateActive)
    {
        //create an audio player and play the sound

        NSString *path = [[NSBundle mainBundle] pathForResource:@"whistle" ofType:@"caf"];
        NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: path];
        AVAudioPlayer *theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:NULL];
        theAudio.volume = 1.0;
        [theAudio prepareToPlay];    
        [theAudio play];
    }

    NSLog(@"didReceiveRemoteNotification %@",userInfo);    
}
Run Code Online (Sandbox Code Playgroud)

push-notification apple-push-notifications ios

3
推荐指数
1
解决办法
1933
查看次数