模拟启动选项

在我的appDelegate ,我有一些规范,当应用程序启动与文件从即邮件应用程序。 当我启动我的应用程序,一切正常。 当我通过从邮件文件启动应用程序,应用程序崩溃。 不幸的是,我无法debugging它,因为我无法模拟launchingOptions 。 目前,我build立并运行,然后断开iPad,closures我的应用程序,然后去邮件等…有没有一种方法来debugging? Appdelegate.m – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSURL *url = (NSURL *)[launchOptions valueForKey:UIApplicationLaunchOptionsURLKey]; IntroViewController *introViewController = (IntroViewController *)self.window.rootViewController; if (url !=nil) { if ([url isFileURL]) { introViewController.fileUrl = url; } } NSLog(@"%@",[url path]); return YES; } IntroViewController – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { NSLog(@"Hello"); if (fileUrl != nil) { […]

主要Bug,在XCAssets文件夹中创build的Sprite Atlas不支持批量渲染

我开始在XCAssets文件夹中使用新的Sprite Atlas,而不是在项目文件夹中使用我的图集。 但是我注意到,当我这样做时,我的节点不再被批处理渲染,导致大量低效的绘制调用。 这完全打败了使用图集的目的! 要清楚这是我用来获得地图集的代码。 let atlas = SKTextureAtlas(named: "Sprites") “Sprites”是在XCAssets文件夹中创build的Sprite Atlas。 有没有人有解决方法,或者我坚持在项目文件夹中制作雪碧套件集合。 我正在使用Xcode 7.2testing版。 之所以我想使用新的Sprite套件集群是因为这个问题。

iOS版本特定的info.plist设置

我正在更新iOS7的应用程序(同时还支持iOS6),并更新状态栏使用UIStatusBarStyle: UIStatusBarStyleLightContent使用白色的前景。 但是, UIStatusBarStyleLightContent值是iOS7中的新增function,因此在iOS6上运行时, UIStatusBarStyle会恢复为UIStatusBarStyleDefault ,并将暗灰色文本iOS6默认为浅灰色。 但我需要我的iOS6版本使用黑色风格的UIStatusBarStyleBlackOpaque状态栏。 鉴于您可以为不同的设备和平台types设置info.plist设置,例如UIStatusBarStyle~ipad : https : //developer.apple.com/library/ios/DOCUMENTATION/iPhone/conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html 我知道我可以通过UIApplication在运行时设置这个值,但是直到启动图像显示之后,这个效果才会UIApplication 。 我希望你可以使用类似的机制的iOS版本? 例如: UIStatusBarStyle: UIStatusBarStyleBlackOpaque UIStatusBarStyle~ios7: UIStatusBarStyleLightContent 但是,这是行不通的,我找不到任何地方的任何苹果文件这样的function。 我运气不好,将不得不在iOS6应用程序启动期间与丑陋的白色状态栏一起生活? 编辑:刚才在这里find了一个类似的问题: iOS – 仅在iOS 6和更高版本的Info.plist中input? 似乎答案是否定的,这是不可能的。 除非iOS7有任何更新?

扫描特定服务CBUUID时无法find外围设备

当我使用: CBUUID * uuid = [CBUUID UUIDWithString:@"1800"]; // GAP DEBUG_LOG(@"CBUUID: %@",uuid); // CBUUID: Generic Access Profile _centralMan = [[CBCentralManager alloc] initWithDelegate:self queue:nil]; [_centralMan scanForPeripheralsWithServices:[NSArray arrayWithObject:uuid] options:nil]; 我找不到我的外设,但是当我使用: _centralMan = [[CBCentralManager alloc] initWithDelegate:self queue:nil]; [_centralMan scanForPeripheralsWithServices:nil options:nil]; 它立即出现 当我连接时,我能够发现/读/写我期待的所有服务。 我的理解是,GAP使这成为可能。 我也尝试了CBUUID的其他服务,我知道运行(特别是“1804”,TX电源服务),无济于事; 扫描从来没有发现任何东西。 即使服务正在运行(我可以沟通瓦特/它们连接时),当我扫描传递服务的UUIDarraysnil ,这个委托方法被称为… -(void) centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI { DEBUG_LOG(@"Found peripheral […]

从Parse iOS下载图像

我正在编写一个应用程序,允许用户在Parse上获取和存储图像。 到目前为止,我已经设法通过使用以下逻辑完成将图像数组保存到分析: 采取形象 将对象添加到数组 将数组转换为NSData 将NSData转换为PFFile 设置file upload目的地(通过唯一的objectId) 上传PFFileparsing 这是代码的样子; 请原谅它现在在dismissViewController的事实,我只是试图让它保存成功: – (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { _takenImage = (UIImage *) [info objectForKey:UIImagePickerControllerOriginalImage]; [self dismissViewControllerAnimated:YES completion:^ { // Add object to array: Working [_tankImagesArray addObject:_takenImage]; NSLog(@"Number of images taken: %lu", (unsigned long)_tankImagesArray.count); // Convert array to NSData Object NSData *imageData = [NSKeyedArchiver archivedDataWithRootObject:_tankImagesArray]; // […]

防止出现在UIPageViewController上的白色空白

我已经以这种方式实现了UIPageViewController: GalleryViewController :是PageViewController的容器 PageViewController :是我把它作为子视图添加到GalleryViewController的pageViewController。 PageContentViewController :我把UIImageView作为页面视图控制器的内容。 一切都很顺利,但当我在图像之间滑动时,会发生奇怪的事情。 上方出现白色的空白。 奇怪的是当我完成滚动它自动延伸。 这是GalleryViewController的代码,它是PageViewController的容器: import UIKit class PageViewController: UIViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate { var startIndex:Int = 0 var pageViewController : UIPageViewController! override func viewDidLoad() { self.navigationController?.hidesBarsOnTap = true; reset() } func reset() { /* Getting the page View controller */ pageViewController = self.storyboard?.instantiateViewControllerWithIdentifier("PageViewController") as UIPageViewController self.pageViewController.dataSource = self let […]

NSArray初始化方法

初始化数组与数组有什么区别 NSArray * array = [NSArray array]; 和 NSArray * array = @[];

将两个表视图添加到Xcode中的主视图

我把两个表视图放到我的main.storyboard上。 然后,我为他们创build了两个新的.swift类文件:VideoTableViewController和LinkTableViewController。 我如何链接这两个? 它看起来像我可能做了这个错误,因为我读我需要委托链接到视图的表视图。 我希望它链接到我为表视图创build的控制器。 我想要做的是有两个并列的列表,一个是video链接,另一个是网页链接。 我已经在数组中的数据。 我只需要将这些数据放到适当的表格视图的单元格中。 我注意到我可以把一个表格视图控制器放到故事板上,但我不认为这是我想要的,因为这是一个完全不同的观点。 我希望这些都是一致的看法。 VideoTableViewController: import Foundation import UIKit class VideoTableViewController: UITableViewController { @IBOutlet weak var videoTable = UITableView() var videos: [Video] = [] override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! { //disable header tableView.contentInset = UIEdgeInsetsMake(-30, 0, -20, 0); var cell : UITableViewCell = tableView.dequeueReusableCellWithIdentifier("Component") as […]

ios writeToFile更改不保存

ios声称文件已经被写入,但是这些改变从来没有真正保存过,就好像它们保持在缓冲区中一样。 我必须冲洗什么? – (void)viewDidLoad { [super viewDidLoad]; NSString *myFilePath = [[NSBundle mainBundle] pathForResource:@"MyFile" ofType:@"txt"]; NSLog(@"\n\nPath = \n%@", myFilePath); NSString *myFileContents = [NSString stringWithContentsOfFile:myFilePath encoding:NSUTF8StringEncoding error:nil]; NSLog(@"\n\nContents = \n%@", myFileContents); [@"This line will be written to file" writeToFile:myFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil]; NSString *changedContents = [NSString stringWithContentsOfFile:myFilePath encoding:NSUTF8StringEncoding error:nil]; NSLog(@"\n\nChanged Contents = \n%@", changedContents); } 输出: Path […]

UIViewController可见的callback

我正在开发一个iOS应用程序,当我有Internet连接和其他的时候需要做一些东西,当我没有。 如果我没有在某个时候,我会显示一条消息给用户给我互联网和回来。 问题是如何检测以下情况: 用户按两次主页button,进入多任务处理,设置并连接到互联网 用户回来多任务到我的应用程序,但不按任何东西 我知道我会得到AppDelegatecallback: – (void)applicationDidEnterBackground:(UIApplication *)application – (void) applicationDidBecomeActive:(UIApplication *)application 但代码(它不是由我开始)这是非常大的,我不想处理那里的UIViewController需要,如果有任何替代。 我的UIViewController的 – (无效)viewDidAppear:(布尔)animation,当用户回来时不会调用它。 这个断点不是肯定的! 任何有用的想法,除了在AppDelegate?