我一直在尝试检查CocoaPods的新框架设置,以便让一些Pod继续运行,而我在使用我的Objective-C项目中的Swift问题时遇到了麻烦.
首先,这是CocoaPods预发布0.35,您可以在这里阅读有关如何使用和安装它的信息.
这是我当前的Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'MBProgressHUD'
pod 'SLPagingViewSwift'
Run Code Online (Sandbox Code Playgroud)
MBProgressHUD是一个常见的旋转指示器,SLPagingViewSwift是一个随机项目,我通过将Swift键入cocoapods搜索找到.这是ViewController.m在我的项目中:
#import "ViewController.h"
@import SLPagingViewSwift;
@import MBProgressHUD;
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
// Works just fine
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:hud];
[hud show:YES];
// Causes Error -- Won't build
SLPagingViewSwift *sl = [[SLPagingViewSwift alloc] init];
}
@end
Run Code Online (Sandbox Code Playgroud)
这是SLPagingViewSwift宣言:
class SLPagingViewSwift: UIViewController, UIScrollViewDelegate {
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,它继承自UIViewController,因此分配它并初始化它不应该是一个问题.如果我将文件单独添加为文件,上面的代码运行就好了.我知道它有效.
TL;博士
如何在纯Objective-C类中使用CocoaPods创建的纯Swift框架?
故障排除
大多数情况下,我一直在尝试各种进口.Apple推荐这里 …
No such module当我尝试构建项目时,我正在寻找Pods.如果我删除期望这个Pod的代码,另一个'没有这样的模块'会出现另一个Pod,这意味着每个Pod都必须受到影响.当我输入时,pod install我收到以下消息:
[!] The X target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `X’. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `X` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `X'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
Run Code Online (Sandbox Code Playgroud)
我为我的应用程序的调试和发布版本以及两个测试获得了这些,所以总共有12条消息.
我已经设置Always …
目前,我正在尝试使用最新版本在我的 flutter 项目中添加firebase_core: ^0.5.0+1和firebase_crashlytics: ^0.2.1+1打包,它在 Android 中没有任何问题,但在 iOS 中,它无法正常工作并出现错误。那么现在如何使用 iOS Flutter 项目中的最新包来运行我的项目呢?
我也试过了,pod repo update但是还是不行
我收到此错误 flutter run
CocoaPods' output:
?
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Finding Podfile changes
A firebase_crashlytics
- Flutter
- contact_picker
- device_info
- file_picker
- firebase_auth
- firebase_core
- firebase_messaging
- flutter_keyboard_visibility
- flutter_local_notifications
- flutter_webview_plugin
- image_picker
- path_provider
- phone_number
- share
- shared_preferences
- …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用新的CocoaPods Trunk服务发布我的库
pod trunk push your-library.podspec
这给出了错误:
[!] You need to register a session first.
如何注册会话?
我pod install和El Capitan一起跑了并得到了这个错误:
Errno::EPERM - Operation not permitted - /Users/../Pods/Pods.xcodeproj/xcuserdata/root.xcuserdatad
Run Code Online (Sandbox Code Playgroud)
这是我的环境:El Capitan(15A279b),Xcode 7.0版(7A220),cocoapod 0.38.2.有任何想法吗?谢谢!!!
我使用xcode7(而不是6.4)的原因是我需要将现有项目定位到iOS9进行测试.我使用El Capitan的原因是xcode7不能在Yosemite下运行.我需要更换一个不再适用于iOS9的库(由cocoapod管理).
以下是我在El Capitan安装cocoapods的方法,
sudo gem install -n /usr/local/bin cocoapods
如此链接建议卸载后无法安装可可豆荚,导致错误
pod --version
回报
0.38.2
我已升级到El Capitan,从那以后我无法更新我的pod.
$ pod update
-bash: pod: command not found
Run Code Online (Sandbox Code Playgroud)
所以我试图重新安装CocoaPods并得到了这个:
$ sudo gem install cocoapods
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj
Run Code Online (Sandbox Code Playgroud)
我是这台电脑的管理员.为什么会这样?
所以这是我的程序.我Podfile在项目目录中创建了一个新的,然后我添加了以下内容
platform :ios, '9.0'
use_frameworks!
target 'CPod' do
pod 'AFNetworking', '~> 2.5'
pod 'ORStackView', '~> 2.0'
pod 'SwiftyJSON', '~> 2.1'
end
Run Code Online (Sandbox Code Playgroud)
我开火了pod install,一切顺利,打开了xcworkspace.然后我去看看ViewController.swift,如果我尝试导入一个我得到的吊舱No such module 'SwiftyJSON',如果我这样做的话import SwiftyJSON.有任何想法吗?
编辑:SwiftyJSON是一个基于Swift的模块,而不是Obj-C
即时通讯尝试在我的项目中安装cocoapods,但我总是遇到错误
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/user_interface/error_report.rb:103: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `open': No such file or directory - /Users/CravenJM/.cocoapods/repos (Errno::ENOENT)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `foreach'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `children'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/sources_manager.rb:63:in `all'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/user_interface/error_report.rb:130:in `repo_information'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/user_interface/error_report.rb:34:in `report'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/command.rb:58:in `report_error'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:300:in `handle_exception'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:274:in `rescue in run'
from /Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:264:in `run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/command.rb:45:in `run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/bin/pod:43:in `<top (required)>'
from /usr/bin/pod:23:in `load'
from /usr/bin/pod:23:in `<main>'
Run Code Online (Sandbox Code Playgroud)
知道它可能是什么或我如何解决这个问题?我需要cocoapods的应用程序,但它是一个噩梦:-)
我遇到了一个全新项目的问题.RestKit和Facebook SDK都会出现此问题.奇怪的是SwiftyJSON工作得很好.我创建了一个全新的swift项目和一个Podfile:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target 'test-fb-swift4' do
pod "FBSDKCoreKit"
pod 'SwiftyJSON', '~> 2.1'
pod 'RestKit', :inhibit_warnings => true
end
target 'test-fb-swift4Tests' do
end
Run Code Online (Sandbox Code Playgroud)
创建该文件后,我运行pod install并使用test-fb-swift4.xcworkspace文件重新打开xcode.
现在我的控制器里面放了一个导入RestKit,我得到错误没有这样的模块'RestKit'.我已经尝试了许多不同的方法来格式化Podfile,甚至是非常简单的版本,例如:
source 'https://github.com/CocoaPods/Specs.git'
pod 'RestKit'
Run Code Online (Sandbox Code Playgroud)
我尝试添加和删除use_frameworks,有和没有目标.有和没有:inhibit_warnings.
我正在运行CocoaPods 0.36.4并尝试了最新的rc构建,同样的交易.另一个项目的Objective-C版本运行正常.这是我使用Swift的第一个项目,我坚持这个问题.