为什么我在xcode控制台中得到这个CPSqliteStatementPerform错误

我在xcode控制台中得到以下错误,但我不知道它只是在抱怨只读数据库: CPSqliteStatementPerform: attempt to write a readonly database for UPDATE ddd.ext_container SET orig_date_modified = (SELECT date_modified FROM container WHERE pid=container_pid) WHERE orig_date_modified=0 CPSqliteStatementReset: attempt to write a readonly database for UPDATE ddd.ext_container SET orig_date_modified = (SELECT date_modified FROM container WHERE pid=container_pid) WHERE orig_date_modified=0 以下代码在错误之前执行: MPMediaQuery *myPlaylistsQuery = [MPMediaQuery playlistsQuery]; NSArray *array = [myPlaylistsQuery collections]; playlists […]

快速从dataTaskWithURL获取进度

在数据下载的时候,有没有办法从dataTaskWithURL中快速获取进度? NSURLSession.sharedSession().dataTaskWithURL(…) 数据下载时我需要显示进度条。

SFSafariViewController:隐藏导航栏

我能够让我的应用程序通过SFSafariViewController自动加载一个url,这个post ,它工作的很好,唯一的缺点是导航栏。 SFSafariViewController导航栏在使用这种方式时是没用的,因为url是只读的,'done'链接除了重新加载页面之外什么都不做。 因此,我想完全隐藏导航栏。 根据接受的答案附带的意见,build议将我的根视图控制器设置为SFSafariViewController,我不能工作。 该设置很简单,因为有一个单一的视图控制器与上述职位中包含的代码。 我怎样才能隐藏导航栏,但仍然保持SFSafariViewController的好处? 或者,如果我不能隐藏导航栏,至less隐藏“完成”的链接? 代码片段: import UIKit import SafariServices class ViewController: UIViewController { private var urlString:String = "https://example.com" override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) let svc = SFSafariViewController(URL: NSURL(string: self.urlString)!) self.presentViewController(svc, animated: […]

创build一个应用程序,从iPhone屏幕创build一个video,并添加来自耳机/audioinput的audio

我试图从这个应用程序(ShowME)完成从iPad屏幕创build教程video使用AVAssetWriter我能够捕捉屏幕的video。 我尝试使用AVCaptureDevice,但它不工作。 我不知道什么是错的。 我从这个链接学习了从iPhone屏幕捕捉video- 一个非常好的turorial。 但它不会捕获任何audio以及屏幕video。 所以我给了这样一个尝试: -(void)setUpMike{ NSError* error = nil; // Setup the audio input AVCaptureDevice *audioDevice = [AVCaptureDevice defaultDeviceWithMediaType: AVMediaTypeAudio]; AVCaptureDeviceInput *audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioDevice error:&error ]; // Setup the audio output _audioOutput = [[AVCaptureAudioDataOutput alloc] init]; // Create the session _capSession = [[AVCaptureSession alloc] init]; [_capSession addInput:audioInput]; [_capSession addOutput:_audioOutput]; _capSession.sessionPreset = […]

iOS EKEvent Store在循环中重新创buildiCloud日历,不会保存本地。

我有一个奇怪的问题EKEventStore,iCloud和本地日历。 如果启用了iCloud,则会创build日历,并按照您的预期将事件保存到日历中。 如果iCloud已closures,并且您尝试保存事件,则不会发生任何事情,但是设备会每3-5秒循环创build一次iCloud日历,直到将iCloud重新打开,然后所有这些日历都以重复的forms涌入iCloud。 我正在使用几乎所有在这里被引用的确切代码以及苹果文档。 我完全被困在为什么它不工作,一般EKEventStore似乎很less有文档。 //••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••#编辑标记 – 保存事件//••••••••••••••••••••••••••••••••••••••• •••• -(void)saveEventWithDate:(NSDate *)startDate endDate:(NSDate *)endDate { AppData *theData = [self theAppData]; if([self checkIsDeviceVersionHigherThanRequiredVersion:@"6.0"]) { [eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) { // iOS 6 Support if (granted){ NSLog(@"Access Granted"); } else { NSLog(@"Access Not Granted"); } }]; } EKEvent *event = [EKEvent eventWithEventStore:eventStore]; NSUserDefaults *defaults = [NSUserDefaults […]

viewForAnnotation混淆和反复定制pinColor

目标是根据存储在结构数组中的某些值自定义引脚颜色。 在这里的一些帮助我实现了下面的viewForAnnotation委托方法,这很好地调用这个委托方法迭代在基于我的结构数据数组的大小循环。 所以,如果我想把所有的引脚设置为一种颜色,例如紫色(这是下面代码中的注释行),它就可以工作。 问题是当我把一个开关设置颜色基于我的数组中的值它通过这个代码,但不尊重任何案件的价值将其设置为一个替代的颜色,一切都去红针(看似默认)。 我已经打印出状态并进行debugging,知道它正在进入开关并设置pinColor的相应,但他们似乎并不坚持。 func mapView(aMapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! { let theindex = mystructindex // grab the index from a global to be used below if annotation is MKUserLocation { //return nil so map view draws "blue dot" for standard user location return nil } let reuseId = "pin" var pinView […]

XCode:架构arm64错误的未定义符号

在我的XCode 5项目中,我使用RestKit进行REST通信。 一切工作正常与模拟器,但生成的IPA文件,我得到以下错误: ld: warning: ignoring file /Users/joseph/Library/Developer/Xcode/DerivedData/XXXXXXXXXX-gdwdekevxtdfivfpsnmyykeqhulk/Build/Products/Debug-iphoneos/libRestKit.a, missing required architecture arm64 in file /Users/joseph/Library/Developer/Xcode/DerivedData/XXXXXXXXXXXXX-gdwdekevxtdfivfpsnmyykeqhulk/Build/Products/Debug-iphoneos/libRestKit.a (2 slices) Undefined symbols for architecture arm64: "_OBJC_CLASS_$_RKRelationshipMapping", referenced from: objc-class-ref in classname-xxx.o "_OBJC_CLASS_$_RKObjectMapping", referenced from: objc-class-ref in classname-xxx.o "_OBJC_CLASS_$_RKRequestDescriptor", referenced from: objc-class-ref in classname-xxx.o "_OBJC_CLASS_$_RKObjectManager", referenced from: objc-class-ref in classname-xxx.o "_OBJC_CLASS_$_RKResponseDescriptor", referenced from: objc-class-ref in classname-xxx.o "_RKStatusCodeIndexSetForClass", referenced from: […]

从CGImageRef的UIImage

我正在尝试一个更复杂的项目的简单testing,但我为什么下面的代码崩溃并给出EXC_BAD_ACCESS错误感到困惑? 这是从UIView调用的。 – (void)testing { NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"ball.png" ofType:nil]; CGImageRef imageRef = [[[UIImage alloc]initWithContentsOfFile:imagePath]CGImage]; // CGImageRetain(imageRef); UIImage *newImage = [[UIImage alloc]initWithCGImage:imageRef]; UIImageView *iv = [[UIImageView alloc]initWithImage:newImage]; [self addSubview:iv]; } 我的猜测是CGImageRef不被保留,但添加CGImageRetain(imageRef); 没有区别。 我也应该注意到这个项目已经开启了ARC。 编辑 我做了一些更多的testing,发现这与ARC直接相关,因为我创build了两个基本项目,只包括上面的代码。 ARC的第一个closures,它完美的工作。 下一个与ARC打开和BAM崩溃与相同的错误。 有趣的是,我第一次在崩溃之前运行项目时,得到了实际的日志错误。 Error: ImageIO: ImageProviderCopyImageBlockSetCallback 'ImageProviderCopyImageBlockSetCallback' header is not a CFDictionary…

谁的观点不在窗口层次结构问题中?

警告:尝试呈现其视图不在窗口层次结构中的视图! 是的,在发布这个问题之前,我已经看过其他问题和答案。 他们没有帮我解决这个问题。 这是我正在做的。 我打电话给我的单身类socialHelper显示一个操作表,其中postToFacebook方法是一个选项select。 当点击这个动作时,我得到了上面的警告,并且不显示postToFacebook 。 我从UIViewController调用这个UINavigationController作为主控制器,而我的SocialHelper类是一个NSOject 。 – (void)postToFacebook { if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { slComposeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; [slComposeViewController setInitialText:@"Building stairs? Checkout StairsPro on the app store!"]; [slComposeViewController addImage:[UIImage imageNamed:@"StairsIcon120x120.png"]]; [slComposeViewController addURL:[NSURL URLWithString:@"https://itunes.apple.com/us/app/stairs-pro/id477032819?ls=1&mt=8"]]; [self presentViewController:slComposeViewController animated:YES completion:nil]; // I've also tried this, which shows the post window, but after hitting cancel or post, […]

在testing项目中找不到“XXX-Swift.h”文件

我试图调用一个NSObject子类的方法,让我们说在testing项目中的XCTestCase子类的方法内的“主”项目。 主项目的NSObject子类导入“XXX-Swift.h”头文件(我正在混合Swift和Objective-C代码)。 所有工作正常,当我运行主项目,但是当我运行testing调用该子类的对象时,我得到一个错误,说在导入中的Swift头文件没有find。 我想我错过了testing目标中的一些设置,但是我没有find哪个…我应该检查什么? 或者我应该怎么做才能解决这个问题?