Tag: ios7

iAd的`UIViewController`类别canDisplayBannerAds是做什么的?

在iOS7中,iAds框架包含类别-[UIViewController canDisplayBannerAds] 。 这个类别做了什么,我该如何使用它?

Unity iOS App大小为1.2GB(实际大小)(Android 100MB)

我有一个应用程序,这是一个团结2D。 导出到Android它重达100MB。 导出到iOS的重量为1.2GB(ipa为104MB),但iTunes内部重量为1.2GB,这太多了。 我们试图减小纹理的大小,但是在设备上图像变得非常像素。 有想法该怎么解决这个吗? 下面是.ipa未压缩的内容显示了获取所有MB的内容: sharedassets4.assets(只是该文件,获得342 MB)

SKColor clearColor返回一个黑色,而不是?

在启动过程中,我SKScene按照以下方式设置了SKScene : -(id)initWithSize:(CGSize)size { if (self = [super initWithSize:size]) { self.backgroundColor = [SKColor clearColor]; } return self; } 但不知何故,我得到的是以下这些,是黑的,根本不清楚: 我在这里错过了什么? 我怎样才能使这个场景清晰? 我已经把这个场景看得清清楚楚了,但这仍然是我得到的。 更新:我也尝试设置myView.opaque = NO; 但是这根本没有帮助。

iOS MKMapShapshotter完成块并不总是被调用

我正在尝试使用新的iOS7 MKMapSnapshotter生成静态地图图像。 每当我的应用程序需要一张地图,我打电话给以下: MKMapSnapshotter *snapshotter = [[[MKMapSnapshotter alloc] initWithOptions:theOptions] autorelease]; dispatch_queue_t aQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0); DebugLog(@"Snapshotter allocated %@ and run on queue %@", snapshotter, aQueue); [snapshotter startWithQueue:aQueue completionHandler:^(MKMapSnapshot *snapshot, NSError *error) { DebugLog(@"Snapshotter completion block %@", snapshotter); // perform selector on main thread to set self.imageView.image = shanpshot.image; } 在大多数情况下,这是行之有效的。 然而有时候,这个设备看起来像是超载了地图请求,然后停止了渲染。 在我的日志文件中,我将看到关于“Snapshotter分配”的第一条日志语句,但从来没有看到“Snapshotter completion block”消息。 我的请求可能永远不会从调度队列中执行吗? […]

NSFileManager中的containerURLForSecurityApplicationGroupIdentifier如何在iOS 7上工作

我想在iOS环境中的多个应用程序之间共享文件。 我已经使用UIDocumentInteractionController机制来达到目的,但由于应用程序之间交换的数据量很大(2Go左右),所以我正面临一个问题。 我正在使用ZipArchive库来收集所有的共享文件,但是在某些情况下它确实会失败以创build巨大的zip文件。 我试图发送一个目录而不是文件,但内容不会被复制。 当我升级到iOS 7时,我试图使NSFileManager中新的可用的containerURLForSecurityApplicationGroupIdentifier方法工作。 我已经遵循了几个例子,但他们是为MAC OS X. 让这个API可用于iOS 7也是一个苹果的错误,或者需要哪些指令才能使其工作。 这里是应用程序权利文件的内容: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.security.app-sandbox</key> <true/> <key>com.apple.security.application-groups</key> <array> <string>$(TeamIdentifierPrefix)com.example.AppFileSharing</string> </array> <key>keychain-access-groups</key> <array> <string>$(AppIdentifierPrefix)com.example.AppFileSharing</string> </array> </dict> </plist> 以下是访问容器的示例代码: NSFileManager* fileManager = [NSFileManager defaultManager]; NSURL* containerURL = [fileManager containerURLForSecurityApplicationGroupIdentifier:@"com.example.AppFileSharing"]; NSLog(@"%@", containerURL); 当我运行应用程序时,containerURL为空。 有这个function工作真是太好了。 问候, 轻拍

iOS的MapKit拖动注解(MKAnnotationView)不再与地图平移

我正在学习在我刚刚起步的iOS应用程序中使用MapKit。 我正在使用一些模型实体作为注释(将<MKAnnotation>协议添加到它们的头文件中)。 我也创build自定义MKAnnotationViews并将draggable属性设置为YES 。 我的模型对象有一个location属性,它是一个CLLocation* 。 为了符合<MKAnnotation>协议,我向该对象添加了以下内容: – (CLLocationCoordinate2D) coordinate { return self.location.coordinate; } – (void) setCoordinate:(CLLocationCoordinate2D)newCoordinate { CLLocation* newLocation = [[CLLocation alloc] initWithCoordinate: newCoordinate altitude: self.location.altitude horizontalAccuracy: self.location.horizontalAccuracy verticalAccuracy: self.location.verticalAccuracy timestamp: nil]; self.location = newLocation; } – (NSString*) title { return self.name; } – (NSString*) subtitle { return self.serialID; } 所以,我有4个必要的方法。 而且他们非常简单。 当我阅读MKAnnotationView和@draggable属性中的苹果文档时,它说: 将该属性设置为YES可使用户拖放注释。 […]

在后台线程从HTML的NSAttributedString

我需要的是从相对较大的HTMLstring创buildNSAttributedString对象,并将它们(NSAttributedString-s)存储在数据库中。 当然,我想在后台线程中这样做。 这里是一个简单的代码(失败)来演示我正在尝试做什么: dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSString *HTMLString = @"<p>HTML string</p>"; NSDictionary *options = @{NSDocumentTypeDocumentAttribute : NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute : @(NSUTF8StringEncoding)}; NSError *error = nil; NSAttributedString *attributedText = [[NSAttributedString alloc] initWithData:[HTMLString dataUsingEncoding:NSUTF8StringEncoding] options:options documentAttributes:nil error:&error]; }); 根据这个讨论 ,根本不可能在后台线程中执行它,因为使用NSHTMLTextDocumentType选项创buildNSHTMLTextDocumentType选项使用WebKit ,它需要在执行任何asynchronous工作时旋转runloop。 但可能是别人想通了? 我有非常简单的HTML,只是文本和链接,可能有一种方法来指定,从HTML创build一个NSAttributedString不会需要任何“ WebKit -rendering”? 或者可能有人可以推荐第三方库从简单的HTML不使用WebKit创buildNSAttributedString ?

从使用iOS 6 SDK构build的应用程序中排除AirDrop和添加到阅读列表

我有一个UIActivityViewController在我的iOS 6应用程序,我推更新,但我还没有编译与iOS 7 SDK。 有没有办法禁用iOS7中的UIActivityViewController添加到阅读列表和AirDrop,而无需使用iOS 7 SDK进行重新编译?

后退button奇怪地消失在UINavigationController但继续工作

在iOS7下,我一直在遇到一个问题,如果后退button项目已经设置了特定的背景图像,它将不会显示: int imageSize = 21; //REPLACE WITH YOUR IMAGE WIDTH [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-400.f, 0) forBarMetrics:UIBarMetricsDefault]; UIImage *barBackBtnImg = [[UIImage imageNamed:@"BackArrowDark.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, imageSize, 0, 0)]; [[UIBarButtonItem appearance] setBackButtonBackgroundImage:barBackBtnImg forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; 在这样做的时候,我在导航控制器中按下的任何ViewController都不会出现后退button项,即使按下它应该出现的位置,也会使其出现,并且随后按下此视图控制器将会使button出现在屏幕上。 这个问题只在iOS7下出现:在iOS6下,一切正常。 使用leftBarButtonItem完全更改后退button将禁用后向滑动,所以这不是一个选项。 任何想法我做错了什么? 非常感谢您的考虑。

MKPolylineRenderer产生锯齿状的,不相等的path

我正在使用iOS 7 MapKit API在显示MKDirectionsRequest生成的path的地图上生成3D相机移动。 path由MKOverlayRenderer渲染,如下所示: -(void)showRoute:(MKDirectionsResponse *)response { for (MKRoute *route in response.routes) { [self.map addOverlay:route.polyline level:MKOverlayLevelAboveRoads]; } } – (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id < MKOverlay >)overlay { MKPolylineRenderer *renderer = [[MKPolylineRenderer alloc] initWithOverlay:overlay]; UIColor *mapOverlayColor = [UIColor colorWithRed:((float)22 / 255.0f) green:((float)126 / 255.0f) blue:((float)251 / 255.0f) alpha:0.8]; renderer.strokeColor = mapOverlayColor; renderer.lineWidth = 13.0; return […]