我正在使用cocoapods,并希望使用特定于调试模式的xcconfig参数在pod的podspec中指定一个值.
目前,使用:
s.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => "MY_DEFINE=1" }
Run Code Online (Sandbox Code Playgroud)
将设置Debug和Release模式的值.还尝试使用:
s.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS[config=Debug]" => "MY_DEFINE=1" }
Run Code Online (Sandbox Code Playgroud)
但是,虽然这将它设置在pod的预处理器宏中,但在执行代码期间似乎没有注册,这与不使用[config = Debug]标记时不同.有没有办法将其限制为仅调试模式?
我最近从一个带有cocoapods安装的基础XCode项目中设置了一个项目,当将项目导入AppCode 3.1时,我没有得到通过CocoaPods安装的swift框架的任何自动完成功能.
这是我的Podfile
# Uncomment this line to define a global platform for your project
platform :osx, '10.10'
use_frameworks!
target 'Main' do
pod "SwiftyJSON", ">= 2.1.3"
pod 'BrightFutures', '~> 1.0.0-beta.3'
end
target 'MainTests' do
end
Run Code Online (Sandbox Code Playgroud)
如您所见,我定义了2个pod(一个是SwiftyJson,一个是BrightFutures).这两个pod都安装为Swift Frameworks(因此为什么use_frameworks!).
所有东西似乎都被导入并且正常用于AppCode(我有两个项目,一个是主项目,另一个是Pods,它与XCode中的完全相同),但似乎AppCode没有索引任何Pod框架,所以我根本没有获得使用这些框架的自动完成状态.例如,在以下代码中
import Cocoa
import BrightFutures
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(aNotification: NSNotification) {
let f = future { 5 }.map{f in f + 7}
f.onSuccess{callback in println(callback)}
// Insert code here to initialize your application
}
func applicationWillTerminate(aNotification: NSNotification) …Run Code Online (Sandbox Code Playgroud) 我已经用 CocoaPods trunk 注册了两个帐户。有没有办法指定推送时使用哪个账号,还是每次推送都需要重新注册中继服务?
我想做pod安装,但是我遇到了这些错误.
错误:
Analyzing dependencies
Cloning spec repo `wackadoo` from `gitATgithub.com:Repo/Repo.git`
[!] Unable to add a source with url `gitATgithub.com:Repo/Repo.git` named `Repo`.
You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.
Run Code Online (Sandbox Code Playgroud)
我想这可能是我的git配置.当我做一个git clone时,我会输入我的用户名和密码.是对的吗?
我的Podfile
source 'git@github.com:sample/sample.git'
source 'https://github.com/CocoaPods/Specs.git'
pod 'RestKit', '~> 0.20.0'
pod 'TestLibrary', :git => 'https://github.com/sample/sample2'
pod 'libARClientIOS', :path => '~/Developer/Test/iPhone/libARClientIOS/'
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |configuration|
target.build_settings(configuration.name)['ARCHS'] = '$(ARCHS_STANDARD_32_BIT)'
end
end
end
Run Code Online (Sandbox Code Playgroud) 在我的项目中,我有Objective c和Swift类.我想在目标c中进行调试断点正在工作,而在Swift中,断点不起作用,因此很难调试.
注意:我正在将我的目标c项目集成到我的swift项目中.
提前致谢.
更新Xcode 7.0.1后,每次崩溃时我都无法打开我的工作区.阅读完所有这些文字后,我理解它是关于集合视图的流程布局,以及一些负面价值.假设我没有机会回到Xcode 6.有没有人有类似的问题,或者知道如何解决这个问题?
例外:
negative sizes are not supported in the flow layout
Run Code Online (Sandbox Code Playgroud)
关于我的工作区:
运用
OS OS X 10.11(macosx10.11):
这是崩溃日志:
XCODE版本信息:
Version = 7.0.1(7A1001)插件版本= 8191 Beta版本= 0 OS版本= 10.10.5(14F27)
断言:
无法确定IBUICollectionView的ibLayoutInset,intrinsicContentSize,baselineOffsetFromBottom,firstBaselineOffsetFromTop,ibLayoutMargins,ibContentSize,ibCellFrames,ibSectionHeaderViewFrames,ibSectionFooterViewFrames和ibBackgroundViewFrame的值.
异常名称:NSInternalInconsistencyException异常原因:流布局中不支持负大小异常回溯:0.CoreFoundation 0x00000001033d5f4d __exceptionPreprocess 1. libobjc.A.dylib 0x0000000102e4fdeb objc_exception_throw
CoreFoundation 0x00000001033d5dca + [NSExceptionraise:format:arguments:]
基础0x0000000102a9dae2 - [NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
UIKit 0x00000001010db6ff - [UICollectionViewFlowLayout _getSizingInfos]
- UIKit 0x00000001010dcef5 - [UICollectionViewFlowLayout _fetchItemsInfoForRect:]
- UIKit 0x00000001010d669d - [UICollectionViewFlowLayout prepareLayout]
- UIKit 0x00000001010f6ef1 - [UICollectionViewData _prepareToLoadData]
- UIKit 0x00000001010f767a - [UICollectionViewData validateLayoutInRect:]
UIKit 0x00000001010a883e - [UICollectionView layoutSubviews] …
我正在使用以下代码在我的Swift应用程序(iOS 9)中播放视频:
let fileUrl = NSBundle.mainBundle().URLForResource("welcome", withExtension: ".mp4")
videoItem = AVPlayerItem(URL: fileUrl!)
videoPlayer = AVPlayer(playerItem: videoItem)
videoPlayer.addObserver(self, forKeyPath: "rate", options: [.New], context: nil)
videoPlayerController.player = videoPlayer
videoPlayerController.showsPlaybackControls = false
videoPlayerController.view.frame = CGRectMake(0, 0, playerView.frame.size.width, playerView.frame.size.height)
playerView.insertSubview(videoPlayerController.view, belowSubview: videoCoverView)
videoPlayerController.willMoveToParentViewController(self)
addChildViewController(videoPlayerController)
videoPlayerController.didMoveToParentViewController(self)
playerView.bringSubviewToFront(btnPlay)
let asset = AVAsset(URL: fileUrl!)
let imageGenerator = AVAssetImageGenerator(asset: asset)
let time = CMTime(seconds: asset.duration.seconds/2.0, preferredTimescale: 1)
do {
let imageRef = try imageGenerator.copyCGImageAtTime(time, actualTime: nil)
let coverImage = UIImage(CGImage: imageRef)
videoCoverView.image = coverImage
} catch {
} …Run Code Online (Sandbox Code Playgroud) 我的应用程序依赖于applicationProtectedDataDidBecomeAvailable被调用,但我注意到,如果我锁定设备并等待大约 3 分钟然后解锁,则applicationProtectedDataDidBecomeAvailable不会被调用。另外,什么时候会applicationProtectedDataDidBecomeAvailable被调用,而不是applicationWillEnterForeground因为我注意到,当它被调用时,有时这些调用的顺序是随机的
多谢你们
self?.performSegue(withIdentifier: "myview", sender: nil)
Run Code Online (Sandbox Code Playgroud)
即使我在故事板中使用推送,上面的代码也不显示导航栏。下面的代码显示了一个错误,即使存在具有正确名称的 segue
self?.navigationController?.performSegue(withIdentifier: "myview", sender: nil)
Run Code Online (Sandbox Code Playgroud)
错误
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“Receiver () 没有标识符为“myview”的 segue”
我最近更新到cocoapods 0.36并对内部规范进行了一些更改,现在podspec不再验证.我用0.35验证了此规范lint的先前版本(0.3.8)并且使用0.36失败了.很明显,cocoapods 0.36要求的东西已经改变了.我知道Swift支持与动态框架一起添加,但我无法确定它为什么失败.
这是podspec
Pod::Spec.new do |s|
s.name = "Infusionsoft-Internal"
s.version = "0.3.8"
s.summary = "Pods to be used internal to Infusionsoft across projects."
s.author = { "Chris Wagner" => "chris.wagner@infusionsoft.com" }
s.homepage = "https://github.com/infusionsoft/Internal-iOS-Pods.git"
s.license = {
:type => 'N/A Copyright by Infusionsoft',
:text => <<-LICENSE
N/A Copyright by Infusionsoft
LICENSE
}
s.source = { :git => "https://github.com/infusionsoft/Internal-iOS-Pods.git", :tag => "0.3.8" }
s.platform = :ios, '7.0'
s.xcconfig = { 'HEADER_SEARCH_PATHS' => '"/usr/include/libxml2"'}
s.libraries = 'xml2'
s.subspec 'Categories' do |cat| …Run Code Online (Sandbox Code Playgroud) ios ×10
cocoapods ×5
swift ×5
objective-c ×2
storyboard ×2
appcode ×1
appdelegate ×1
autocomplete ×1
autolayout ×1
avplayer ×1
crash ×1
flowlayout ×1
git ×1
podspec ×1
restkit ×1
xcode6.3 ×1
xcode7 ×1