小编mcd*_*mcd的帖子

更改firebase数据模型(多个应用程序版本正在生产中)

Firebase在生产中有多个版本的iOS应用程序时,更改数据模型的最佳方法是什么?

由于中间没有"应用程序服务器"层,因此数据库模型中的任何更改都可能会破坏旧版本的应用程序.

性能相关问题示例:

在版本1.0中,我天真地保留了与"/ posts /"下的帖子相关的所有内容.现在在2.0版本中,我想采用Firebase的建议并添加一个'/ user-post'端点来快速列出给定用户的所有帖子.

使用iOS应用1.0版的人不会将任何数据写入'/ user-posts',因为该端点以前不存在.因此,使用2.0版本的人看不到使用旧版应用程序的人创建的任何帖子.

从理论上讲,我可以在某个地方创建一个服务器来监听'/ post /'上的更改,并将它们添加到'/ user-posts'中.如果您有很多不同版本的应用程序,那么这似乎很难维持.

新功能问题示例:

让我们在你的移动应用程序的1.0版中说你写了新帖子到'/ posts /'.现在,在您的应用程序的2.0版本中,您将引入一个团队功能,所有帖子都需要在'/ team/team-id/posts'中.

尚未升级到2.0版的人仍将写入'/ posts'.使用版本2.0的用户从'/ team/team-id/posts'中读取这些帖子是不可见的.

我意识到你可以同时保留两个端点(以及基于团队ID的索引/帖子),但随着时间的推移,这似乎很难维护.

传统方案:

如果我使用的是Django或Express,我会进行数据库迁移,然后更新服务器端端点以创建博客帖子.

这将从客户端对数据库进行更改.我理论上可以在我的架构中添加一个应用程序服务器层Firebase,但这似乎不建议:https://firebase.googleblog.com/2013/03/where-does-firebase-fit-in-your -app.html

architecture firebase firebase-realtime-database

13
推荐指数
1
解决办法
555
查看次数

我可以将音乐库添加到Xcode iOS模拟器吗?

我正在尝试为iPhone和iPad创建一个音乐播放器.我在iPhone和iPad上完美运行,因为那些实际上有一个音乐库.但是我想使用fastlane和其他一些测试工具,所以我需要能够看到/添加一个音乐库到我的模拟器.

我已导航到我的模拟器文件夹. /Users/maikohermans/Library/Developer/CoreSimulator/Devices/8A14CCDB../Data
但是我不知道在哪里看,如果我甚至应该看这里添加音乐.

我希望有人可以帮我解决这个问题.我搜索了这个,但似乎没有人问这个问题很长一段时间.所以这意味着要么每个人都放弃了它,要么就有可能,我似乎无法弄清楚如何做到这一点.

xcode ios-simulator mpmedialibrary xcode8

13
推荐指数
1
解决办法
4131
查看次数

将Google Places API与Alamofire 4.0和iOS 10以及Swift 3配合使用

我的项目目前在Xcode 8和Swift 3中使用Alamofire 4.0构建.我使用CocoaPods来实现Alamofire.

我的podfile如下:

# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
use_frameworks!

target 'WTB’ do
# Comment the next line if you're not using Swift and don't want to use        dynamic frameworks
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => ’4.0.0’


pod 'SwiftyJSON', git: 'https://github.com/BaiduHiDeviOS/SwiftyJSON.git',     branch: 'swift3'

pod 'GooglePlaces'    #doesn't work when this line is added
pod 'ChameleonFramework'
end        
Run Code Online (Sandbox Code Playgroud)

尝试安装googlePlaces pod时,我在终端中收到以下错误:

- `Alamofire (from `https://github.com/Alamofire/Alamofire.git`, tag    `4.0.0`)` required by `Podfile`
- …
Run Code Online (Sandbox Code Playgroud)

ios google-places-api cocoapods swift alamofire

11
推荐指数
1
解决办法
903
查看次数

如何快速本地化故事板?

我正在尝试使用Swift 3和Xcode 8.1本地化我的应用程序.

我正在尝试使用storyboard(main.strings(德语))本地化应用程序并以编程方式使用"NSLocalizedString".

我可以"NSLocalizedString"使用以下代码以编程方式进行本地化

func localized(lang:String) ->String {

        let path = Bundle.main.path(forResource: lang, ofType: "lproj")
        let bundle = Bundle(path: path!)

        return NSLocalizedString(self, tableName:  nil, bundle: bundle!, value: "", comment: "")
    }
Run Code Online (Sandbox Code Playgroud)

但我坚持使用故事板中定义的本地化.我在main.strings(德语)中定义了本地化字符串.

/* Class = “IBUILabel”; text = “Date :”; ObjectID = “0sh-CK-26C”; */
“0sh-CK-26C.text” = “Datum :”;
Run Code Online (Sandbox Code Playgroud)

有没有办法在运行时本地化故事板?

xcode localization storyboard ios swift3

11
推荐指数
1
解决办法
732
查看次数

Firebase Storage Web:如何上传文件

我在我的网站上添加了以下功能.我正在使用Firebase存储但由于某种原因,它似乎不起作用,我不知道为什么.

上传文件时,进度条应显示将文件保存/上传到Firebase存储的进度,但情况并非如此.Firebase已初始化,我知道它有效.

如果有人能帮助我并告诉我为什么功能不能如上所述以及如何解决它,我将不胜感激.

function AddMed() {
        var uploader = document.getElementById("uploader");
    var fileButton = document.getElementById("fileButton");
    var email = sessionStorage.getItem("email");
  //Listen for file selection

    fileButton.addEventListener('change', function (e) {
    // Get File 
        var file = e.target.files[0];
    //Create a storage ref

        var storageRef = firebase.storage().ref('file/' + file.name);
    /** folder name will be email, 
    Will have to transfer variable from page to page and files will be .jpeg**/
    //Upload file 

        var task = storageRef.put(file);
    //Update progress bar

        task.on('state_changed',
                function progress(snapshot) {
                var percentage = (snapshot.bytesTransferred …
Run Code Online (Sandbox Code Playgroud)

web firebase firebase-storage

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

将uilabel从一个视图拖放到另一个视图-iOS

我正在努力将uilabl从一个视图拖放到另一个视图.请检查以下代码并帮助我.

  CGPoint point = [[[event allTouches] anyObject] locationInView:self.view];
  UIControl *control = sender;
  control.center = point;
Run Code Online (Sandbox Code Playgroud)

使用下面的代码无法正确拖动.

drag-and-drop uiview uilabel uitouch ios

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