标签: ios-simulator

XCode:位置模拟器不调用locationManager:didUpdateToLocation:FromLocation

当我在XCode上使用位置模拟器并更改位置时,它不会调用locationManager:didUpdateToLocation:FromLocation函数.但是当我得到当前位置时,它正在获得新位置.是这样的意思还是这个错误?它目前不会影响我的应用程序,只是很难调试位置更改.

我正在使用startMonitoringSignificantLocationChanges,如果这有任何区别.

xcode locationmanager ios-simulator

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

UISegmentedControl setSelectedSegmentIndex问题

我对UISegmentedControl有一个奇怪的问题.我正在使用以下方法设置选定的段索引:

[self.toolbarSegmentedControl setSelectedSegmentIndex:0];
Run Code Online (Sandbox Code Playgroud)

所以问题是 - 点击处理程序:

- (IBAction)segmentedControlClick:(id)sender 
Run Code Online (Sandbox Code Playgroud)

不是在模拟器中调用,而是在传递此方法时调用它.为什么这样,错误和正确的行为在哪里?

objective-c uikit ios ios-simulator

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

$ .get在带有PhoneGap的iPhone模拟器中返回"[object Document]"

我正在尝试$.get()在我的(XCode)iPhone模拟器(使用PhoneGap)的本地文件上做一个简单的请求,但结果仍然以" [object Document]"(通过警报)而不是文件的实际内容返回.

但是,当我在谷歌浏览器中测试它时,我完全没有问题.奇怪的是,我可以$.load()在本地页面没有问题(在iPhone模拟器中),但是当我尝试$.get()它时,它不会工作.

这是我的index.html代码:

<script type="text/javascript" src="js/phonegap.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>

<div class="load"></div>

<script>

    $.get('content/view/images.html', function(data) {

        alert(data); // returns "[object Document]"

    });

    $('.load').load('content/view/images.html'); // returns actual file content

</script>
Run Code Online (Sandbox Code Playgroud)

这是我的content/view/images.html代码:

<img src="http://static.example.com/images/{$file_key}.{$file_type}" style="max-width: 100%; max-height: 200px;" />
Run Code Online (Sandbox Code Playgroud)

但是,当我将内容更改为content/view/images.html类似的东西时LOL,它会正确$.get().

关于世界上发生了什么的任何想法?

jquery xcode ios-simulator cordova

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

使用模拟器的多个项目

我正在使用Xcode模拟器比较多个项目的运行.每次在运行其他项目之后我去构建一个项目时,Xcode告诉我它无法执行构建和运行,因为模拟器正在使用中.然后我必须找到另一个项目窗口,在模拟器中停止运行(Cmd-.),然后切换回上一个窗口并重建.我可以制作单个键盘快捷键来停止模拟器中的当前运行,在模拟器中构建和运行当前项目吗?

xcode xcode4 ios-simulator

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

如何更改iOS Simulator SDK

可能重复:
如何更改ios sdk?

还有其他方法可以将iOS模拟器SDK更改为硬件 - >版本?

感谢帮助.

编辑: 最后我用applescript得到它

set selectedVersion to "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk"

set thePListFolderPath to path to preferences folder from user domain as string
set thePListPath to thePListFolderPath & "com.apple.iphonesimulator.plist"
tell application "System Events"
tell property list file thePListPath
tell contents
set value of property list item "currentSDKRoot" to selectedVersion
end tell
end tell
end tell
Run Code Online (Sandbox Code Playgroud)

iphone xcode ipad ios ios-simulator

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

Objective C:imageNamed加载非现有图像

我使用循环将图像加载到NSMutableArray.每次迭代使用以下imagedNamed函数加载图像UIImage:[UIImage imageNamed:*name*];.

但是,我想改变一些图像.所以我从项目中删除了图像并添加了新图像.但是当我在iOS模拟器中运行应用程序时,会出现旧图像.即使我从项目中删除了所有图像,它们仍会出现.

有人可以解释为什么会发生这种情况,以及我如何改变它?

objective-c imagenamed ios ios-simulator

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

为什么我的视频在模拟器中播放但在使用AVFoundation Videoplayer的设备(iPad)上播放?

我建立了自己的自定义视频播放器(编辑:在这里找到示例代码)

AVMoviePlayerView.h

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>

@class AVPlayer;

@interface AVMoviePlayerView : UIView

@property (nonatomic) AVPlayer *player;

- (void)setPlayer:(AVPlayer*)player;
- (void)setVideoFillMode:(NSString *)fillMode;

@end
Run Code Online (Sandbox Code Playgroud)

AVMoviePlayerView.m

#import "AVMoviePlayerView.h"
#import <CoreMedia/CoreMedia.h>

@implementation AVMoviePlayerView


+ (Class)layerClass {

    return [AVPlayerLayer class];

}

- (AVPlayer*)player
{
    return [(AVPlayerLayer*)[self layer] player];
}

- (void)setPlayer:(AVPlayer*)player
{
    [(AVPlayerLayer*)[self layer] setPlayer:player];
}

- (void)setVideoFillMode:(NSString *)fillMode
{
    AVPlayerLayer *playerLayer = (AVPlayerLayer*)[self layer];
    playerLayer.videoGravity = fillMode;
}


@end
Run Code Online (Sandbox Code Playgroud)

在我的MainViewController.m中调用它 - (void)viewDidLoad

    NSURL* url = [[NSBundle mainBundle] URLForResource:@"myVideo.264" withExtension:@"mp4"]; 
    self.avPlayer = …
Run Code Online (Sandbox Code Playgroud)

objective-c avfoundation ipad ios-simulator ios5

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

iOS模拟器 - 只需一步即可将视网膜iPhone转换为非视网膜iPad

我为iPhone和iPad编程.在做iPhone的时候,我更喜欢视网膜iPhone模拟器.在做iPad的时候,我更喜欢非视网膜模拟器.在他们之间交换对我来说是一个两步的过程.我必须将xCode从"iPhone模拟器"目标切换到"iPad模拟器"目标.问题是,当我这样做时,模拟器从视网膜iPhone切换到视网膜iPad.因此,我还必须进入模拟器应用程序并将硬件更改为非视网膜iPad.

有没有办法一步完成?

iphone xcode ipad ios-simulator

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

模拟低和高Gps精度

我做了一个.gpx文件来在IOS模拟器上模拟路线,现在我想模拟水平精度我该怎么做?

如下是我的.gpx文件的摘录:

<?xml version="1.0"?>
<gpx>
    <wpt lat="-23.772830" lon="-46.689820"/> //how add horizontal accuracy 7 meters for example
    <wpt lat="-23.774450" lon="-46.692570"/> //and here horizontal accuracy of 2 metters for example
    <wpt lat="-23.773450" lon="-46.693530"/> //and here 19 meters
</gpx> 
Run Code Online (Sandbox Code Playgroud)

如果我运行所有gps点返回的水平精度为5米,则可以更改此设置。

gps emulation gpx ios-simulator

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

模拟器/设备UI与故事板不同

我正在使用Xcode 4.5.1创建一个非常简单的单视图iPhone应用程序.我已经在IB图像中看到了视图.(UIViewController,UIView,UIButton,UITextView).

当我在模拟器(或我的手机)中运行应用程序时,它看起来像第二个屏幕截图.

我不明白为什么模拟器UI看起来不像我在IB中创建的那个.

我错过了什么?

谢谢!

InterfaceBuilder中 模拟器

xcode storyboard uiviewcontroller ios ios-simulator

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