Tag: ios8

无法让我的位置显示在iOS 8的Google地图中

我正在尝试在iOS 8的Swift项目中使用Google Maps for iOS。我添加了Objective-C桥接标头,并按照其文档中的说明添加了Google Maps SDK。 我试过这个例子,它工作得很好。 我需要显示我目前的位置。 我在我的iOS 8模拟器中设置自定义位置的坐标,并修改了这个 StackOverflow答案中显示的代码。 下面是它的Swift版本。 import UIKit import Foundation class MapViewController: UIViewController { @IBOutlet var mapView: GMSMapView! var firstLocationUpdate: Bool? override func viewDidLoad() { super.viewDidLoad() let camera = GMSCameraPosition.cameraWithLatitude(-33.86, longitude: 151.20, zoom: 12) mapView = GMSMapView.mapWithFrame(CGRectZero, camera: camera) mapView.settings.compassButton = true mapView.settings.myLocationButton = true mapView.addObserver(self, forKeyPath: "myLocation", […]

iOS 8 .scheduledLocalNotifications为空

我试图更新我的应用程序到iOS 8.在一个函数中,我安排了一个本地通知(我已经检查过,通知的所有其他部分是正确的)以这种方式: [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; 那么我使用这个代码打印预定的本地通知: NSLog(@"notifications %@", [UIApplication sharedApplication].scheduledLocalNotifications ); 但arrays [UIApplication sharedApplication].scheduledLocalNotifications 即使通知未被触发,也是空的。 然后,为了检查本地通知是否真的计划好了,我试着使用这个代码 NSLog(@"notification appdelegate %@", application.scheduledLocalNotifications ); 在函数中 – (void)applicationWillResignActive:(UIApplication *)application 在这种情况下, Appdelegate.m的计划本地通知数组不是空的,NSLog函数打印正确的通知。 这只发生在真实的设备上,在模拟器我的应用程序工作正常。 问题是不检查用户的权限来安排本地通知,因为我已经面对它。 有人可以帮我吗? 一些想法?

字体描述符在iOS 8中返回零

下面的代码可以在iOS 7中正常工作,但是不会在iOS 8中返回粗体或斜体字体。对于Helvetica Neue来说没问题,但是对Arial字体不起作用。 UIFontDescriptor *descriptor1 = [UIFontDescriptor fontDescriptorWithFontAttributes:@{UIFontDescriptorFamilyAttribute: @"Arial"}]; UIFontDescriptor* boldFontDescriptor1 = [descriptor1 fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold]; UIFont* font1 = [UIFont fontWithDescriptor:boldFontDescriptor1 size:16.0]; [self.lblArialB setFont:font1]; 在设备和模拟器上testing,仍然是一样的错误。

初始化需要“self”作为参数的Swift属性

我有一个Swift类,我想看起来像这样: class UpdateManager { let timer: NSTimer init() { timer = NSTimer(timeInterval: 600, target: self, selector: "check", userInfo: nil, repeats: true) } func check() { // Do some stuff } } 但是,Swift不喜欢我将self传递给NSTimer初始值设定项的事实。 我在这里打破一些模式? 一个人应该如何完成这样的初始化?

为什么在IOS8中使用coreBluetooth connectPeripheral没有调用委托方法

我想在IOS8中使用CoreBluetooth.framework来实现数据传输,我在下面的方法中发现了外设并尝试连接外设。 – (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI { NSLog(@"Discover name : %@", peripheral.name); [self.centralManager connectPeripheral:peripheral options:nil]; } 但它没有调用委托方法didFailToConnectPeripheral或didConnectPeripheral ,我waner有什么问题呢,是代码错误还是IOS8需要一些额外的东西? 如何处理,提前致谢! 这里是我在github的代码,我写了一个程序作为服务器,另一个是中央。

如何在Swift中存档和取消存档自定义对象? 或者如何将自定义对象保存到Swift中的NSUserDefaults?

我有一堂课 class Player { var name = "" func encodeWithCoder(encoder: NSCoder) { encoder.encodeObject(name) } func initWithCoder(decoder: NSCoder) -> Player { self.name = decoder.decodeObjectForKey("name") as String return self } init(coder aDecoder: NSCoder!) { self.name = aDecoder.decodeObjectForKey("name") as String } init(name: String) { self.name = name } } 我想序列化并保存到用户的默认值。 首先我不确定如何正确编写编码器和解码器。 所以对于init我写了两个方法。 当我尝试执行此代码: func saveUserData() { let player1 […]

更新文本后,animation块将重置为原始位置

我目前正在testing我的IOS 8版本的应用程序。我注意到,在执行了一个animation块之后,如果我更新了任何标签的文本,animation将重置。 我用下面的一个方法运行了一个简单的例子。 运行这个例子的结果如下: 第一次点击myButtonanimation运行,但当标签文本被改变时重置。 第二次单击myButton – animation运行但不会重置为原始位置。 这似乎是因为标签文本没有改变。 如果我完全删除了更新文本的行,这也会阻止animation在最后重置。 我想解决这个问题,以便当方法运行时,标签文本可以更新而不需要重新设置animation。 – (IBAction)move:(id)sender { [UIView animateWithDuration:0.4 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ self.myButton.center = CGPointMake(200, 300); }completion:^(BOOL finished){ if(finished){ self.myLabel.text=@"moved"; } }]; }

致命错误:NSArray元素无法匹配Swift数组元素types

突然我开始得到运行时错误, fatal error: NSArray element failed to match the Swift Array Element type 我宣布我的arrays为, var myArray : [CUSTOM_CLASS] = [CUSTOM_CLASS]() 现在,在我的服务器响应成功块中, self.myArray = dicResponse["data"]! as Array println(self.myArray) // FATAL ERROR HERE 升级到Xcode6 Beta6之前,这是完美的 FYI : dicResponse["data"]! // is verified as valid (抱歉指向错误的地方!) 解决了 : 不知道,但我做了一些改变,它的工作原理, var myArray = [AnyObject]() self.myArray = dicResponse["data"]! as [AnyObject]

dyld:图书馆没有加载框架内的框架

我想embedded一个框架,正在使用另一个框架,这在模拟器中工作得很好,但它在iOS设备上崩溃: dyld:Library未加载:@ rpath / FrameworkB.framework / FrameworkB引用自:/private/var/mobile/Containers/Bundle/Application/B072CD7C-8595-4AE4-A506-26832A0F4402/FrameworkTest.app/Frameworks/FrameworkA.framework/ FrameworkA原因:找不到图片 这是我在Xcode中的结构: FrameworkTest.xcodeproj(应用程序项目) FrameworkA.xcodeproj(cocoa触摸框架) FrameworkB.xcodeproj(cocoa触摸框架) 应用程序(FrameworkTest)使用FrameworkA(embedded在FrameworkTest应用程序中)的一个类A 类A使用FrameworkB中的类B (它在FrameworkA中链接)。 这在模拟器中工作得很好,但在设备上不起作用。 这个结构看起来可能有点奇怪,但是当我开发应用程序时,我正在开发框架,这就是为什么我要在我的应用程序项目中添加框架项目的原因。 我已经上传了GitHub上的项目给你看,如果你需要仔细看看。 (类A在AppDelegate.m文件中被调用) 为什么这是在iOS模拟器,而不是在设备上工作? 我怎样才能使它在设备上工作? 编辑: 正如simonthumperbuild议在评论中,我也尝试添加FrameworkB.framework Copy Files作为框架目标在构build阶段FrameworkA,但是这给了我在控制台中的这个错误: dyld:Library未加载:@ rpath / FrameworkB.framework / FrameworkB引用自:/private/var/mobile/Containers/Bundle/Application/2A38A2BC-9CD7-4AF6-9E50-42C16D92D6B2/FrameworkTest.app/Frameworks/FrameworkA.framework/ FrameworkA原因:没有find合适的图像。 find了:/private/var/mobile/Containers/Bundle/Application/2A38A2BC-9CD7-4AF6-9E50-42C16D92D6B2/FrameworkTest.app/Frameworks/FrameworkA.framework/Frameworks/FrameworkB.framework/FrameworkB:mmap()error 1 at地址= 0x10012C000,大小= 0x00008000段= __ TEXT在Segment :: map()映射/ private / var / mobile / Containers/Bundle/Application/2A38A2BC-9CD7-4AF6-9E50-42C16D92D6B2/FrameworkTest.app/Frameworks/FrameworkA.framework /Frameworks/FrameworkB.framework/FrameworkB

在iOS8中,如何在iMessages / FB Messenger中以横向模式启用键盘?

在我的项目中,我有textViews与相关的input键盘在iOS8下的iPhone 6 Plus上的横向模式有奇怪的外观,如下所示: 内部有时似乎有不同的方向。 但是在某些情况下,键盘旋转很好,但是在方向改变和其他可见的错误时仍然有白色的空隙: 最后我们有了普通的扩展景观视图: 问题是如何获得没有错误的扩展键盘,如下所示: