我的团队有一些完整的Obj-C库,我们喜欢在我们的项目中重用.要做到这一点,我们通常设立一个Git子模块,然后将其添加到Xcode项目作为子项目(使用target dependency,link binary with library并更新User Header Search Paths)
到目前为止,它只在完整的Obj-C项目中完成,我现在正尝试在Swift项目中使用它,但迄今为止收效甚微.我试图添加briding-header文件,在项目中引用它并填充它如下:
#import "MyLibraryHeader.h"
Run Code Online (Sandbox Code Playgroud)
目标标题位于User Header Search Paths.
它让我构建,但在我的Swift文件中使用它时:
let test = MyLib();
let secondTest = MyLib.classMethod1("some_arguments");
Run Code Online (Sandbox Code Playgroud)
我得到一个EXC_BAD_INSTRUCTION上secondTest,并在调试以下日志:
(lldb) po test
error: <EXPR>:1:1: error: use of unresolved identifier 'test'
(lldb) po secondTest
error: Error in auto-import:
failed to get module 'MyProject' from AST context:
/Users/siegele/Sources/MyProject_iOS/MyProject/Classes/MyProject-Bridging-Header.h:12:9: error: 'MyLibraryHeader.h' file not found
#import "MyLibraryHeader.h"
^
failed to import bridging header '/Users/siegele/Sources/MyProject_iOS/MyProject/Classes/MyProject-Bridging-Header.h' …Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的一个应用程序更新到iOS7.问题是,在我MKMapView,当我点击一个引脚时,它显示了Callout,但是当点击rightCalloutAccessoryView它时,它不再向委托发送任何回调.因此,我无法推动细节视图.
它在iOS6上运行良好,在iOS7上不再适用.
这是相关的代码:
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
if ([annotation isKindOfClass:[MKUserLocation class]]) {
return nil;
}
NSString * annotationIdentifier = nil;
if ([annotation isKindOfClass:VPStation.class]) {
annotationIdentifier = @"stationAnnotationIdentifier";
}
if (!annotation) {
return nil;
}
MKPinAnnotationView * annotationView = [(MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier] retain];
if(annotationView == nil) {
annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotationIdentifier];
annotationView.canShowCallout = YES;
annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
annotationView.image = [UIImage imageNamed:@"MyAnnotationPin"];
annotationView.centerOffset = CGPointMake(-10.0f, 0.0f);
}
annotationView.annotation = …Run Code Online (Sandbox Code Playgroud)