小编sli*_*kas的帖子

iOS故事板传递数据navigationViewController

我在视图之间正确传递数据时遇到问题,但不是标准方式.

描述我的问题的图片:

http://i.stack.imgur.com/0jHYC.png

performSegueWithIdentifier两个赛格瑞标识符中的一个,然后我想将数据传递给视图控制器称为"FIRMY"或"Oddzialy".

传递数据代码:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
  if ([[segue identifier] isEqualToString:@"sLogowanieFirmy"]) {
      FirmyVC *firmyVC = [segue destinationViewController];
      firmyVC.tabFirmy = self.tabFirmy;
  }
  if ([[segue identifier] isEqualToString:@"sLogowanieOddzialy"]) {
      OddzialyVC *oddzialyVC = [segue destinationViewController];
      oddzialyVC.wybranaFirma = [self.tabFirmy objectAtIndex:0];
  }
}
Run Code Online (Sandbox Code Playgroud)

问题是方法[segue destinationViewController]因为segue的destinationViewController是NavigationViewController.

那么传递数据和拥有独立的导航控制器的正确方法是什么?

cocoa-touch objective-c storyboard navigationcontroller ios

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

Firebase AB 测试的变体比例失调

我们遇到了 AB 测试变体不成比例的问题。从理论上讲,两种变体的变体暴露程度应该几乎相同,这实际上与我们之前所做的 AB 测试效果相当好。 ab 测试配置 1 ab 测试配置 2

正如您在屏幕截图中看到的,当前总用户数为 161k,变体有 75.4k 和 85.9k。我们已经运行此测试几次,并稍微更改了代码,但每次都会出现类似的不成比例。

在运行的 AB 测试中,我们将远程配置参数“ios_show_recent_searches_v2”空字符串设置为默认值。

使用激活事件运行 ab 测试的代码如下所示:

@objc class FireBaseService: NSObject {
    struct Constants {
        static let recentSearchesABTestToggleKey: String = "ios_show_recent_searches_v2"
        static let abTestNotAvailableKey: String = "N/A"
    }

    @objc class func start() {
        FirebaseApp.configure()
        let remoteConfig = RemoteConfig.remoteConfig()

        let oldShowRecentSearches = showRecentSearches

        remoteConfig.fetch(withExpirationDuration: 0.0) { (status, error) -> Void in
            DispatchQueue.main.async {
                if status == .success {
                    remoteConfig.activateFetched()
                    FireBaseService.notifyRecentSearchesVisiblityChangeIfNeeded(oldValue: oldShowRecentSearches)
                    FireBaseService.sendRecentSearchesActivationEventIfNeeded()
                }
            }
        }
    }  

    private class func hasConfigs(for key: String) …
Run Code Online (Sandbox Code Playgroud)

ab-testing ios firebase firebase-remote-config firebase-ab-testing

5
推荐指数
0
解决办法
600
查看次数

检测ajax请求调用

(我是java世界的新手)

我正在学习dropwizard,我想创建返回视图(html)或json的资源,具体取决于请求类型(ajax与否)

例:

@Path("/")
public class ServerResource {

    @GET
    @Produces(MediaType.TEXT_HTML)
    public MainView getMainView() {
        return new MainView("Test hello world");
    }
}
Run Code Online (Sandbox Code Playgroud)

如果请求是AJAX,如何在相同的Path JSON响应中添加到此资源?

更新1. 我创建了这样的东西:

@Path("/")
public class ServerResource {

    @GET
    @Consumes(MediaType.TEXT_HTML)
    @Produces(MediaType.TEXT_HTML)
    public MainView getMainView(@HeaderParam("X-Requested-With") String requestType) {
        return new MainView("hello world test!");
    }

    @GET
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public List<String> getJsonMainView() {
        List<String> list = new ArrayList<String>();
        for (Integer i = 0; i < 10; i++) {
            list.add(i, "test" + i.toString());
        }
        return list;
    }
}
Run Code Online (Sandbox Code Playgroud)

看起来这是按预期工作,但我知道这不是一个好习惯.

java jax-rs dropwizard

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

在Json.toJson()之后播放ebean的Date字段格式

当我试图在Controller方法结果中返回JSON时,我在Ebean模型中正确格式化日期字段时遇到问题

ok(Json.toJson(userObj));
Run Code Online (Sandbox Code Playgroud)

我的代码示例:

@Entity
@Table(name = "user")
public class User extends Model {
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_id_seq")
    public Integer id;

    @Formats.DateTime(pattern = "yyyy-MM-dd hh:mm:ss")
    public Date last_login;
...
}
Run Code Online (Sandbox Code Playgroud)

表位于postgresql数据库中 - 字段last_login是时间戳.

Json的结果是:

{"id":202,"last_login":1386775797494,...}
Run Code Online (Sandbox Code Playgroud)

有人可以解释一下如何让它发挥作用吗?

最好的问候,卢卡斯

json playframework ebean playframework-2.0

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