小编use*_*063的帖子

通知观察员在哪里适合VIPER模式?

我正在将我的项目改为VIPER模式.

我的主要观点有很多观察者.我找不到将观察员放在VIPER的哪个位置.

因为我不想把我的观察者放在视野中.以前我有观察员的单独课程,当有使用通知时,我用来更新主视图.

但在新的VIPER中,我不知道哪里是最好的地方.

我应该制作新的VIPER-N吗?N用于通知观察.

ios swift viper-architecture

7
推荐指数
1
解决办法
338
查看次数

域= AVFoundationErrorDomain,代码= -11828

我正在使用CloudFront的流URL。

范例网址:https//d14nt81hc5bide.cloudfront.net/qyYj1PcUkYg2ALDfzAdhZAmb

在android上,它运行良好,但在iOS中显示:domain = AVFoundationErrorDomain,代码= -11828

从Apple doc读取的错误代码11828为AVErrorFileFormatNotRecognized。无法打开媒体,因为它不是公认的格式。

有人可以建议如何解决此错误吗?

avfoundation ios amazon-cloudfront react-native react-native-video

7
推荐指数
1
解决办法
562
查看次数

我们可以像 Sqlite 和 CoreData 一样免费使用 Realm 数据库吗?

我正在做一个 React-Native 项目。我被要求在本地保存数据,然后我决定在 Realm 中这样做。

很快我发现它有云数据库的定价选项。我无法确定这个数据库是否可以使用像它提到的 sqlite 或 CoreData 这样的替代方法:

"Used by 100k+ developers and downloaded over two billion times. Realm Database is a fast, easy to use, and open source alternative to SQLite and Core Data."
Run Code Online (Sandbox Code Playgroud)

我可以免费使用 Realm 在本地保存数据吗?

android realm ios react-native

6
推荐指数
2
解决办法
3886
查看次数

iOS Swift:将我的日期对象的分钟设置为 0

首先,我的日期采用字符串格式:“06-04-2017 06:28:17 PM”

然后我使用以下方法转换为 Date():

let formatter = DateFormatter()
formatter.dateFormat = "dd-MM-yyyy hh:mm:ss a"
formatter.timeZone = TimeZone(abbreviation: "GMT")
let startdate = formatter.date(from: sdate!)
print(startdate)
Run Code Online (Sandbox Code Playgroud)

这是上面的输出日期: startdate = 2017-04-06 18:28:17 +0000

但是当我尝试使用以下代码将分钟设置为值 0 时。我的日子改变了。

let calender = Calendar.current
calendar.timeZone = TimeZone(abbreviation: "UTC")!
let date =  calender.date(bySettingHour: Int(hour)!, minute: 00, second: 00, of: startdate!)
print(date)
Run Code Online (Sandbox Code Playgroud)

输出:2017-04-07 12:15:00 +0000

在我设置时区后,我的时区是+5:45。我遇到了同样的错误。

任何帮助。高度赞赏。

使用以下代码我得到相同的日期:

let formatter = DateFormatter()
formatter.dateFormat = "dd-MM-yyyy hh:mm:ss a"
formatter.timeZone = TimeZone(abbreviation: "GMT")
let startdate = formatter.date(from: sdate!)
print(startdate)
Run Code Online (Sandbox Code Playgroud)

**但是我这里不能将分钟设置为0。**

timezone date ios swift

4
推荐指数
1
解决办法
9251
查看次数

类型'UICollectionView'的值没有成员'beginUpdates' - Swift 3问题

我正在使用NSFetchedResultsController来获取核心数据.

并且实现controllerWillChangeContent()方法.

        self.collectionView.beginUpdates()
Run Code Online (Sandbox Code Playgroud)

显示来自Xcode 8,swift 3的错误.

任何建议.

uicollectionview swift swift3

3
推荐指数
1
解决办法
6101
查看次数

如何获取 uicollectionview 的最后一个索引路径?

我想获取 uicollectionview 的最后一个索引路径。

我试过这个:

 NSInteger section = [self numberOfSectionsInCollectionView:self.collectionView] - 1;
NSInteger item = [self collectionView:self.collectionView numberOfItemsInSection:section] - 1;
NSIndexPath *lastIndexPath = [NSIndexPath indexPathForItem:item inSection:section];
Run Code Online (Sandbox Code Playgroud)

但找不到 uicollectionview 的最后一个索引路径。

任何建议,提前致谢。

nsindexpath ios uicollectionview

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

iOS - Firebase过滤器查询

我在Firebase中获得了分数节点:

在得分节点下我的数据结构如下:

{
"jjTO29ziQ2SjrH5PFzY7ZMpSgjq1-Kak6FCyGtdy_kcEPd4K" =     {
    jjTO29ziQ2SjrH5PFzY7ZMpSgjq1 = "-Kak6FCyGtdy_kcEPd4K";
    score = 5;
};
"jjTO29ziQ2SjrH5PFzY7ZMpSgjq1-KbE_pgfUsukOm4uW0bx" =     {
    jjTO29ziQ2SjrH5PFzY7ZMpSgjq1 = "-KbE_pgfUsukOm4uW0bx";
    score = 4;
};
Run Code Online (Sandbox Code Playgroud)

问题: 我可以按分数过滤数据吗?

我试过做:

FIRDatabase.database().reference().child("scores").queryOrdered(byChild: "score").observeSingleEvent(of: .value, with: { (snapshot) in

        debugPrint(snapshot.value ?? "nil")

    })
Run Code Online (Sandbox Code Playgroud)

但是不能得到结果?

图片1

ios firebase swift firebase-realtime-database

0
推荐指数
1
解决办法
487
查看次数