search

Home  >  Q&A  >  body text

ios - 连续请求出现相同的数据,求解。

选择好发票点击确定,然后会跳转到添加好的页面。

但是真机测试会出现一个问题,选好内容后快速的多次点击确定,会出现两条相同的数据。

但是已经做了判断

还是会出现重复情况,加了一行代码 ,希望延迟0.5秒再操作。

[self performSelector:@selector(GoToNext) withObject:nil afterDelay:0.5f];

还是不起作用,求解。

迷茫迷茫2769 days ago294

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 17:54:41

    1. After clicking the OK button, immediately set the OK button to a non-clickable state and do not release it until it is completed.
    2. "Two identical data will appear" - what does this refer to, is it stored in the database?

    • If it is stored in a database, you can control it so that the second duplicate item is not added.

    • If it is a network request, cancel the first one when sending the second request.

    reply
    0
  • Cancelreply