小编Lub*_*bbo的帖子

iOS Playground不显示UI预览

我用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)

xcode uikit ios swift swift-playground

56
推荐指数
4
解决办法
4万
查看次数

AirPrint:在UIPrintInteractionController中设置默认打印机

我需要一种方法,使用已知的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)

printing objective-c ios airplay

5
推荐指数
1
解决办法
3372
查看次数

xcodebuild 构建操作以分发带有剥离 dSYM 的动态框架

我曾经使用以下方法构建用于内部开发的动态框架

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用于构建动态框架是否正确?
  • 工件不应该放在相关的 .xcarchive 中吗?
  • 是否有其他设置可用于将生成的工件正确放置在 .xcarchive 中?
  • 您通常如何构建和分发动态框架?

----- 编辑:2017 年 6 月 9 日 -----

  • 是否有其他设置可用于将生成的工件正确放置在 .xcarchive 中?
  • 工件不应该放在相关的 .xcarchive 中吗?

设置后:

Skip Install (SKIP_INSTALL) = NO 
Run Code Online (Sandbox Code Playgroud)

.xcarchive 正确填充了二进制 dSYM 和其他东西。

debug-symbols ios ios-frameworks dsym

5
推荐指数
0
解决办法
832
查看次数

GooglePlus与CocoaPods链接错误

我添加到我的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)

linker-errors ios google-plus cocoapods

2
推荐指数
1
解决办法
2660
查看次数