Tag: ios10

URLscheme“prefs:root = PASS”iOS10

我知道有很多关于这个问题的话题,但有没有解决scheme? 我还没有find官方的文件。 我的问题是我需要redirect我的代码在这样的存储设置:(工作在iOS 9) let settingsUrl = NSURL(string: "prefs:root=CASTLE&path=STORAGE_AND_BACKUP") if let url = settingsUrl { UIApplication.shared.openURL(url as URL) } 但是既然ios10这个方法不行,那么有没有其他办法呢? 我看到SnapChat,谷歌地图redirect他们的应用程序不同部分的设置(不是设置的主屏幕),所以我认为有一个解决scheme。 我已经在info.plist中实现了urlscheme,但它仍然不起作用 我尝试了这个方法,但同样的问题 let settingsUrl = NSURL(string: "prefs:root=CASTLE&path=STORAGE_AND_BACKUP") if let url = settingsUrl { if #available(iOS 10.0, *) { UIApplication.shared.open(URL.init(string:"Prefs:root=General&path=STORAGE_ICLOUD_USAGE/DEVICE_STORAGE")!, options: [UIApplicationOpenURLOptionUniversalLinksOnly:true], completionHandler:{(success: Bool?) -> Void in}) } else { UIApplication.shared.openURL(url as URL) } } […]

模拟器.app为ios 10不工作在ios 8

基本上我运行我的项目到iOS 10,并从那里复制.app,并尝试运行在不同的机器上的iOS 8模拟器,但没有得到安装。 但理想情况下,它应该安装和运行完美。 所以ios 10模拟器。应用程序只与iOS 10的iOS 8兼容,我们再次必须在iOS 8模拟器上运行它,并复制 有没有人可以解释这个问题

UISwitch操作在iOS 10中不起作用

我在桌子视图的一个单元格中有一个开关button。 以前在iOS 9中,一切正常,点击切换button后将转到操作方法。但更新到iOS 10后,操作方法永远不会被调用。 任何人都有类似的问题? cell.m -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code UIImageView *bgView = [[UIImageView alloc] initWithFrame:CGRectZero]; [bgView setImage:[[UIImage imageNamed:@"customcell.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 10, 10, 10)]]; [self setBackgroundView:bgView]; UIImageView *selectedBgView = [[UIImageView alloc] initWithFrame:CGRectZero]; [selectedBgView setImage:[[UIImage imageNamed:@"cellselect.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 10, 10, 10)]]; [self setSelectedBackgroundView:selectedBgView]; nameLabel = [[UILabel alloc] […]

无法设置URLRequest授权标头

由于swift 3更新,我将我的请求从NSMutableURLRequest更改为URLRequest。 之后,所有我的请求停止工作,由于凭证无效问题。 已经尝试过,search一切。 我的服务继续和以前一样,并从请求模拟器testing我的请求,并没有问题。 let url : NSString = "http://url.service.com/method?param=\(name)" as NSString var request = URLRequest(url: URL(string: url.addingPercentEscapes(using: String.Encoding.utf8.rawValue)!)!) request.httpMethod = "POST" request.setAuthorizationHeader() URLSession.shared.dataTask(with: request) {data, response, err in do { //something } catch let error1 as NSError { //something } }.resume() 我的setAuthorizationHeader()扩展 extension URLRequest { mutating func setAuthorizationHeader(){ let data = "user:password".data(using: String.Encoding.utf8) […]

每日通报Swift 3

我试图找出如何发送一个通知,每天在特定的时间(比如上午8点),没有用户input,并使用新的UNMutableNotificationContent而不是弃用的UILocalNotification而不是使用用户input来触发它,而是一个时间。 所有的解释如果发现是旧的,不包括ios 10和swift 3。 我到目前为止。 ViewController.swift中的授权通知: override func viewDidLoad() { UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge], completionHandler: {didAllow, error in }) } Notification.swift let localNotification = UNMutableNotificationContent() // localNotification.fireDate = dateFire localNotification.title = "title" localNotification.body = "body" localNotification.badge = 1 localNotification.sound = UNNotificationSound.default() 我知道我必须设置一个触发器和其他的东西,但我不知道如何得到它的工作。

本地通知 – 重复快速间隔3

我想每周重复本地通知,在iOS10之前有repeatInterval ,但我无法find适合在iOS10中重复通知的任何内容。 TimeTrigger和calendarTrigger都有重复的真实或错误,我可以在哪里申请重复每周,每天,每月。 谢谢。

UNCalendarNotificationTrigger不会被存储,除非重复是真实的

我注意到,如果我创build一个自定义date的UNCalendarNotificationTrigger它不会被添加,除非我把: let trigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: **true**) 苹果例子是: let date = DateComponents() date.hour = 8 date.minute = 30 let trigger = UNCalendarNotificationTrigger(dateMatching: date, repeats: true) 这是有道理的重复==真实。 在我的情况下,我不需要创build一个重复多次的通知,但是我需要在特定的日历date(这当然是将来)中只触发一次的多个通知。 如果我在做: let calendar = Calendar(identifier: .gregorian) let formatter = DateFormatter() formatter.dateFormat = "yyyyMMdd" let newdate = formatter.date(from: "20161201") let components = calendar.dateComponents(in: .current, from: newdate!) let trigger […]

CGImageDestinationFinalize或UIImageJPEGRepresentation – 在IOS 10上保存大文件时发生崩溃

我正在尝试为更大的图像创build切片,而且从IOS 10开始,下面的代码看起来不再起作用,并且与EXC_BAD_ACCESS一起崩溃。 这只发生在IOS 10设备上,IOS 9工作正常。 任何大于〜1300×1300的图像都会发生崩溃。 仪器分析不会产生任何有趣的信息,并指向CGImageDestinationFinalize。 没有记忆秒杀。 我尝试了以下两种方法: UIImage* tempImage = [UIImage imageWithCGImage:tileImage]; NSData* imageData = UIImageJPEGRepresentation(tempImage, 0.8f); // CRASH HERE. 要么 + (BOOL) CGImageWriteToFile: (CGImageRef) image andPath: (NSString *)path { CFURLRef url = (__bridge CFURLRef)[NSURL fileURLWithPath:path]; CGImageDestinationRef destination = CGImageDestinationCreateWithURL(url, kUTTypeJPEG, 1, NULL); if (!destination) { NSLog(@"Failed to create CGImageDestination for %@", path); […]

在核心数据中存储NSMeasurement或NSUnit

iOS 10引入了用于测量和单位的新类。 我想要将NSMeasurement或NSUnit对象存储在我的核心数据库中,这样我就可以在数据库中存储不同的度量。 有没有一个好的方法来做到这一点? 由于我的应用程序只使用所有可用单元的一个子集,因此理论上可以创build单元的string表示forms,并在需要时使用switch语句来获取实际的单元类。 但是这感觉过于复杂和容易出错。

Swift 3本地通知不会触发

我有以下设置,并没有任何通知是在所有的射击。 根据堆栈上的其他类似问题,我已经为每个请求添加了一个唯一的标识符,并且还将内容添加到了内容中。 我有这个要求用户许可的function。 func sendIntNotifications() { //1. Request permission from the user UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound], completionHandler: { (granted, error) in if granted { print ("Notification access granted") } else { print(error?.localizedDescription) } UNUserNotificationCenter.current().delegate = self }) // This function has a lot of other code that then calls this function to set multiple notifications […]