通过"pod update"更新我的Firebase后,我收到如下错误:
ld: warning: directory not found for option '-F/Users/bennysantoso/Library/Developer/Xcode/DerivedData/FCM-atfcxuircoryufazlomgwfgmvaqm/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: framework not found GoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
这是我的Podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
target 'BB' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for BB
target 'BBTests' do
inherit! :search_paths
# …Run Code Online (Sandbox Code Playgroud) 我坚持一个设计决策,为表视图的单元格创建视图模型.每个单元的数据由数据源类(具有数组Contacts)提供.在MVVM唯一的视图模型可以谈的模式,但它没有意义把数据源视图模型,因为这将使得有可能为所有单元存取数据,也这是错误的把数据源视图控制器,因为它必须没有参考数据.还有一些其他关键时刻:
cellForRowAtindexPath 不得放在视图模型中,因为它不应包含任何UI引用什么是为插入MVVM关系中的单元格"插入"数据源的正确方法?谢谢.
nil尽管ListCell是有效的类,但仍打印以下代码.
var lCellClass : AnyClass! = NSClassFromString("ListCell");
println(lCellClass);
Run Code Online (Sandbox Code Playgroud)
文档说该方法返回
由aClassName命名的类对象,或者
nil当前没有加载该名称的类.如果aClassName是nil,则返回nil.
我也尝试获得NSClassFromString()当前的viewcontroller,它已经加载但仍然可以获得nil
可能是什么问题?
更新:
即使尝试这样做NSClassFromString("Array")我仍然得到nil
我正在尝试将一系列文件从iPhone上传到服务器,目的是即使应用程序处于后台或暂停,也会上传这些文件.
我正在使用由它及其系列API 提供的后台传输NSURLSession.
奇怪的是它在两周前完全正常工作.如:
最近几天,我一直在网络模块之外进行一些重构.几天前我再次尝试上传时,只要按下"主页"按钮,上面的步骤(3).当我再次进入应用程序时,文件上传将停止.上传将恢复.
这就好像后台上传甚至不起作用(对于一个文件,更不用说多个文件).
我已多次运行代码,发现它的工作量约为1/50.但其他49次没有.我还检查了以前使用的代码版本(服务器+ iOS),它不再有效 - 或者说,工作很少变化(1/50)
多次完成背景传输和URL会话生命周期的规则,以确保我遵守Apple建议的指导方针,我正在绞尽脑汁想知道什么破坏了,这让人难以理解这是多么不合逻辑 - 我怀疑它是代码实现以外的东西.
所以任何帮助都表示赞赏......
1)在init我的网络类(单例)的方法中,我初始化NSURLSessionConfiguration和NSURLSession:
urlSessionConfigUpload = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:kBACKGROUND_SESSION_CONFIG_ID];
urlSessionConfigUpload.sessionSendsLaunchEvents = YES;
urlSessionConfigUpload.discretionary = YES;
urlSessionConfigUpload.HTTPMaximumConnectionsPerHost = 8;
urlSessionConfigUpload.networkServiceType = NSURLNetworkServiceTypeBackground;
urlSessionConfigUpload.HTTPShouldUsePipelining = NO;
urlSessionConfigUpload.allowsCellularAccess = NO;
urlSession = [NSURLSession sessionWithConfiguration:urlSessionConfigUpload delegate:self delegateQueue:nil];
Run Code Online (Sandbox Code Playgroud)
2)有一种方便的方法叫做实际上传.每个会话只有1个上传任务:
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url];
[urlRequest setHTTPMethod:@"PUT"];
[urlRequest addValue:@"keep-alive" forHTTPHeaderField:@"Connection"];
[urlRequest addValue:contentType forHTTPHeaderField:@"Content-Type"];
// NB: for upload …Run Code Online (Sandbox Code Playgroud) 下载Xcode 8并迁移到Swift 3后,我无法再归档项目.同时,项目建立没有任何问题.
我得到的错误:
体系结构armv7的未定义符号:
"Swift.UnsafeMutableBufferPointer.(subscript.materializeForSet:(Swift.Int) - > A).(closure#1)",引自:Swift.UnsafeMutableBufferPointer的泛型特化的函数签名特化:Swift.MutableCollection在Swift和Swift.UnsafeMutableBufferPointer:Swift中的Swift.RandomAccessCollection> of Swift._siftDown(inout A,index:A.Index,subRange:Swift.Range,by:inout(A.Iterator.Element,A.Iterator.Element) - > Swift.Bool) - >()在OrderCoordinator.o函数签名中使用Swift.UnsafeMutableBufferPointer进行泛型特化:WSift中的Swift.MutableCollection和Swift.UnsafeMutableBufferPointer:Swift中的Swift.RandomAccessCollection> Swift._heapSort(inout A,subRange: Swift.Range,by:inout(A.Iterator.Element,A.Iterator.Element) - > Swift.Bool) - >()在OrderCoordinator.o函数签名中使用Swift.UnsafeMutableBufferPointer进行泛型特化:Swift.Mu swift和Swift.UnsafeMutableBufferPointer中的tableCollection:Swift中的Swift.RandomAccessCollection> Swift._partition(inout A,subRange:Swift.Range,by:inout(A.Iterator.Element,A.Iterator.Element) - > Swift.Bool) - > OrderCoordinator.o中的A.Index:未找到架构armv7 clang的符号:错误:链接器命令失败,退出代码为1(使用-v查看调用)
通过在以下函数中注释数组排序代码,我能够摆脱错误:
func didFinishWithResults(_ results: [PhotoProcessorResult]) {
guard let album = albumService.currentAlbum else { return }
//let sortedResults = results.sorted(by: { $0.fileIndex < $1.fileIndex })
let updateItems = zip(sortedResults, album.assetItems).map { (photoProcessorResult, assetItem) -> UpdateItem in
UpdateItem(path: photoProcessorResult.filePath, position: photoProcessorResult.fileIndex, isCover: assetItem.isCover)
}
albumService.updateAlbumWithItems(updateItems) { (success, …Run Code Online (Sandbox Code Playgroud) 当滚动方向是水平时UICollectionView,从上到下
添加单元格
对于滚动方向=垂直,它们是从左到右添加的.

问题是,当滚动方向是水平时,是否有任何方法可以从左到右添加单元格?
我有几篇很长的文本(数万个字符)。在 SQLite 中存储此类文本的最佳选择是:TEXT 还是 BLOB?
我正在开发一个 iOS 移动应用程序,我的要求是获取段落的第一行并从段落的其余部分更改其字体。例如 - 如果我有一个段落 -
let sampleString = "IS1 这是示例文本。
这个示例文本很好。这需要将字符串分成两部分。第一行的文字与其余部分不同。”
我曾尝试使用 -
let stringToSplit = sampleString.characters.split(".").map(String.init)
Run Code Online (Sandbox Code Playgroud)
但我得到的结果是 - 第一部分是 - IS1 这是示例文本。
剩余字符串即将到来 - 这需要将字符串分成两部分。第一行与其余的文本不同。
“此示例文本很好”这一行。没有出现。
你能帮忙吗。XCode 8.0,斯威夫特 2.3
谢谢。
我发现了类似的问题,但没有一个对我有帮助。我需要将表格标题中的背景颜色设置为白色,现在为灰色(与表格的背景颜色相同)。
这是我的tableView功能:
func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int)
{
let header = view as! UITableViewHeaderFooterView
header.backgroundColor = UIColor.white
header.textLabel?.font = UIFont(name: "Futura", size: 13)!
header.textLabel?.textColor = UIColor.blue
}
func tableView(tableView: UITableView, ViewForHeaderInSection section: Int) -> UIView? {
tableView.backgroundColor = UIColor.white
return tableView
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String?
{
return titles[section]
}
Run Code Online (Sandbox Code Playgroud)
我将背景色设置为白色,但是没有任何变化。
我在 QTableWidget 中显示了一个项目列表,每个项目对应一个特定的文件夹。
在此旁边,我有一个带有 QFileSystemModel 的 QTreeView。当我从 QTableWidget 中选择一个项目时,它会调用一个插槽(如下所示)以显示相应的文件夹内容。
void MyWidget::diplayFolder(int row)
{
if (auto item = table->item(row, 1))
{
QString correspondingDirectory = item->text();
if (QDir(correspondingDirectory).exists())
{
// treeModel => QFileSystemModel
// tree => QTreeView
treeModel->setRootPath("");
treeModel->setRootPath(correspondingDirectory);
tree->setRootIndex(treeModel->index(correspondingDirectory));
}
else
{
qDebug() << "Reset tree => do not display anything!";
// treeModel->setRootPath("");
// tree->reset();
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果目录不存在,我不想显示任何内容。但是,当我尝试设置空的根路径或重置视图时,它会显示我所有的计算机驱动器。
如何重置或清除 QTreeView ?
我在 Swift 中有点中级,想知道是否可以编写一个应用程序来打开另一个已安装在手机上的应用程序并在后台运行它(例如:打开 Spotify、导航到播放列表并启动的应用程序)在后台自动播放音乐,而永远不会离开实际的应用程序)。
我不太确定如何解决这个问题,或者是否有可能,所以我为我缺乏代码而道歉。谢谢。
我试图将NSInteger(标签)保存到NSUserDefaults但我还没有找到一种方法来做到这一点甚至可能
保存数据
[[NSUserDefaults standardUserDefaults] setInteger:label forKey:@"key1"];
Run Code Online (Sandbox Code Playgroud)
检索数据
- (void)viewDidLoad {
label = [[NSUserDefaults standardUserDefaults] integerForKey:@"key1"];
[super viewDidLoad];
Run Code Online (Sandbox Code Playgroud)