我用XCode 7.1创建了一个简单的游乐场,我输入了这个简单的代码:
import UIKit
import XCPlayground
var str = "Hello, playground"
let color = UIColor (red: 1 , green: 1 , blue: 0 , alpha: 0 )
let view = UIView()
view.backgroundColor = UIColo (colorLiteralRed: 1 , green: 0 , blue: 0 , alpha: 0 )
view.frame = CGRect (x: 0 ,y: 0 ,width: 100 ,height: 100 )
let label = UILabel (frame: CGRect (x: 5 , y: 5 , width: 50 , height: 20 ))
label.text = str
view.addSubview(label) …Run Code Online (Sandbox Code Playgroud) 我需要一种方法,使用已知的printerId将选定的打印机强制显示到UIPrintInteractionController.
注意:要进行测试我在我的"MacBook Pro"上安装了Printopia,共享"打印机"
我做了这个测试:
-(IBAction)print:(id)sender
{
UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController];
UIPrintInteractionCompletionHandler completionHandler = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
NSLog(@"Selected Printer ID: %@",printController.printInfo.printerID);
};
NSString* path = [[NSBundle mainBundle] pathForResource:@"TestImage" ofType:@"png"];
NSURL* imageURL = [NSURL fileURLWithPath:path isDirectory:NO];
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputPhoto;
printInfo.jobName = @"Image print";
controller.printInfo = printInfo;
controller.printingItem = imageURL;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
[controller presentFromBarButtonItem:self.printButton animated:YES completionHandler:completionHandler]; // iPad
}
else
{
[controller presentAnimated:YES completionHandler:completionHandler]; // iPhone
}
}
Run Code Online (Sandbox Code Playgroud)
打印完成后,应用程序将记录以下打印机ID:
?\032Printer\032@\032MacBook\032Pro._ipp._tcp.local. …Run Code Online (Sandbox Code Playgroud) 我曾经使用以下方法构建用于内部开发的动态框架
xcodebuild -workspace <workspace_path> build -configuration "Release"
Run Code Online (Sandbox Code Playgroud)
现在我们正在向 3rd 方开发人员提供框架,我们希望从框架二进制文件中删除符号。
我注意到使用build选项二进制文件总是包含符号,即使项目配置为:
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
STRIP_INSTALLED_PRODUCT = YES
STRIP_STYLE = non-global
Run Code Online (Sandbox Code Playgroud)
似乎使用archivexcodebuild 操作,框架是用没有符号的二进制文件和单独的 dSYM 文件生成的。
但是存档操作会产生一个 .xcarchive 空目录(在~/Library/Developer/Xcode/Archives/<DATE>)
生成的工件(二进制文件和 dSYM)可以在 ~/Library/Developer/Xcode/DerivedData/<project_build_dir>/Build/Intermediates/ArchiveIntermediates/<framework_name>.framework/BuildProductsPath/Release-iphoneos
archive用于构建动态框架是否正确?----- 编辑:2017 年 6 月 9 日 -----
- 是否有其他设置可用于将生成的工件正确放置在 .xcarchive 中?
- 工件不应该放在相关的 .xcarchive 中吗?
设置后:
Skip Install (SKIP_INSTALL) = NO
Run Code Online (Sandbox Code Playgroud)
.xcarchive 正确填充了二进制 dSYM 和其他东西。
我添加到我的pod文件中
pod 'google-plus-ios-sdk', '1.4.1'
Run Code Online (Sandbox Code Playgroud)
我做了一个
pod update
Run Code Online (Sandbox Code Playgroud)
我进口了
#import <GooglePlus/GooglePlus.h>
Run Code Online (Sandbox Code Playgroud)
但如果我尝试
[GPPSignIn sharedInstance].clientID = kClientID;
Run Code Online (Sandbox Code Playgroud)
我从链接器收到此错误:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_GPPSignIn", referenced from:
objc-class-ref in SDSocialManager.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud) ios ×4
airplay ×1
cocoapods ×1
dsym ×1
google-plus ×1
objective-c ×1
printing ×1
swift ×1
uikit ×1
xcode ×1