首页 \ 问答 \ iOS - PassBook自动更新(iOS - PassBook Automatic Updates)

iOS - PassBook自动更新(iOS - PassBook Automatic Updates)

我创建了一个传递文件并添加到钱包中。 我想知道我错过了哪些会在通行证后面显示自动更新选项? 如下图所示: https//dxjl3qy52c1o9.cloudfront.net/wp-content/uploads/2016/03/22080644/ios-apple-wallet-share-526x1024.png

我的通行证背面如下图所示: https//support.apple.com/library/content/dam/edam/applecare/images/en_US/iOS/iphone6-ios9-wallet-pass-auto-updates-inshell.jpg

我通过两种方式添加了传递,一种是通过电子邮件手动发送,另一种是在xcode包资源中添加传递文件,并从那里通过代码获取并使用本教程中提到的Passkit框架添加: https://www.captechconsulting .COM /博客/ IOS-6教程-整合-存折-到-你的应用程序

我是否需要集成服务器才能显示该选项? 当我在苹果文档( https://developer.apple.com/library/ios/documentation/PassKit/Reference/PassKit_WebService/WebService.html#//apple_ref/doc/uid/TP40011988 )中阅读某些内容时其他答案。

我不是要更新传球,我只是想知道为什么这个选项没有显示在我自己的传球后面。 如果有人能澄清这一点,我会非常感激。


I created a pass file and added in the wallet. I was wondering what am I missing that will show the Automatic updates option at the back of the pass ? Like in this image : https://dxjl3qy52c1o9.cloudfront.net/wp-content/uploads/2016/03/22080644/ios-apple-wallet-share-526x1024.png

Back of my pass looks like this Image : https://support.apple.com/library/content/dam/edam/applecare/images/en_US/iOS/iphone6-ios9-wallet-pass-auto-updates-inshell.jpg

I added the pass by two ways, one was manually by sending via email and other was adding pass file in the xcode bundle resources and fetching from there via code and adding using Passkit framework as mentioned in this tutorial: https://www.captechconsulting.com/blogs/ios-6-tutorial-integrating-passbook-into-your-applications

Do I need to have a server integrated to make that option show up ? As I read something of the sort in the apple documentation (https://developer.apple.com/library/ios/documentation/PassKit/Reference/PassKit_WebService/WebService.html#//apple_ref/doc/uid/TP40011988) and some other answers.

I am not trying to update the pass, I was just wondering for learning purpose why is that option is not shown at back of my own pass. If some one can clarfiy this, I would be very thankful.


原文:https://stackoverflow.com/questions/36405833
更新时间:2022-10-20 16:10

最满意答案

停止使用std::bind 。 这是一个随机的功能和怪癖混乱。

今天的怪癖是, std::bind将接受无限数量的参数并丢弃任何额外的参数。 明天你可能会遇到这样一个事实:将std::bind结果传递给std::bind会产生奇怪的效果。

std::bind被移植到同一时间增加了语言的lambdas。 Lambdas几乎解决了每个问题bind问题,就像清晰的语法一样,并且没有让怪癖bind问题,特别是在auto lambda表达式可用后的C ++ 14之后。 (大多数C ++ 11编译器也支持auto lambda)。

您可以编写函数,使其中一个或另一个在他们都适用时是首选的超载。 但是这样做会给你的界面增加一堆噪音,在这种情况下,你想要这个偏好的唯一原因是因为std::bind做了一些愚蠢的事情。

围绕设计不佳的std库进行工程是不值得的。 只需停止使用std库的设计不佳的地方,或者在明确使用的地方使用。


如果没有,请这样做:

template <class T, class F,
  std::enable_if_t<
    std::is_convertible<
      std::result_of_t<std::decay_t<F> const&(Value<T> const&)>,
      bool
    >{}, int
  > = 0
>
void Add(Value<T> &value, F&& f)
{
  // do pass f Value<T>
}
template <class T, class F,
  std::enable_if_t<
    !std::is_convertible<
      std::result_of_t<std::decay_t<F> const&(Value<T> const&)>,
      bool
    >{}
    && std::is_convertible<
      std::result_of_t<std::decay_t<F> const&()>,
      bool
    >{}, int
  > = 0
>
void Add(Value<T> &value, F&& f)
{
  // do not pass f Value<T>
}

我们在这里抛出一些令人讨厌的SFINAE检测,在你想使用的两个重载中选择哪一个,并明确地选择一个。

这不值得。


Stop using std::bind. It is a mess of random features and quirks.

Todays quirk is that std::bind will accept an unlimited number of arguments and discard any extra ones. Tomorrow you might run into the fact that passing std::bind result to std::bind does strange magic.

std::bind was ported over to boost at the same time lambdas where added to the language. Lambdas solve almost every problem bind does in just as clear syntax and fails to have the myraid of quirks bind does, especially post C++14 when auto lambdas are available. (Most C++11 compilers also supported auto lambda).

You can write functions so that one or the other is the preferred overload when they both apply. But doing so adds a pile of noise to your interface, and in this case about the only reason why you'd want that preference is because std::bind is doing something stupid.

Engineering around a poorly designed bit of std library is not worth it. Simply stop using that poorly designed bit of std library, or at point of use cast explicitly.


Failing that, do this:

template <class T, class F,
  std::enable_if_t<
    std::is_convertible<
      std::result_of_t<std::decay_t<F> const&(Value<T> const&)>,
      bool
    >{}, int
  > = 0
>
void Add(Value<T> &value, F&& f)
{
  // do pass f Value<T>
}
template <class T, class F,
  std::enable_if_t<
    !std::is_convertible<
      std::result_of_t<std::decay_t<F> const&(Value<T> const&)>,
      bool
    >{}
    && std::is_convertible<
      std::result_of_t<std::decay_t<F> const&()>,
      bool
    >{}, int
  > = 0
>
void Add(Value<T> &value, F&& f)
{
  // do not pass f Value<T>
}

where we throw some nasty SFINAE detection on which of the two overloads you want to use, and explicitly prefer one.

This is not worth it.

相关问答

更多
  • std::bind用于部分功能应用 。 也就是说,假设你有一个函数对象f ,它有3个参数: f(a,b,c); 你想要一个只有两个参数的新的函数对象,定义如下: g(a,b) := f(a, 4, b); g是函数f的“部分应用”:中间参数已经被指定,还有两个可以去。 你可以使用std::bind来获取g : auto g = bind(f, _1, 4, _2); 这比实际写一个函子类更简洁。 在您链接的文章中还有其他示例。 当您需要将函子传递给某种算法时,您通常会使用它。 你有一个函数或函数, 几 ...
  • 使用libc ++时,我得到了相反的结果。 std::unique_ptr nothing; f(std::move(nothing)); // Works! f(nothing); // Fails to compile! 我相信这是一个gcc4.4错误。 [func.bind.bind] / p10 / b3描述了这种情况: 如果is_placeholder::value的值j不为零,则参数为std::forward ,其类型Vi为Uj&& ...
  • 编译器无法决定使用哪个重载函数,如果只指定名称,可能的修复: std::for_each(source.begin(), source.end(), std::bind( static_cast(Strip), std::placeholders::_1, symbol)); Compiler can not decide which overload function to ...
  • 如果你不打算将任何参数传递给func ,它应该是std::function 。 void(int)签名意味着您打算为它提供一个整数,这是它所期望的 。 而且你的代码显然没有提供必要的参数。 如果你打算将参数传递给func ,它需要是A::print的参数,如下所示: void A::print(std::function func, int a) { func(a); } 您的尝试指定函数参数命名为a moot。 由于A::print没有a引用。 以上也意 ...
  • 绑定对象作为左值传递,并且无法复制promise 。 让你的lambda采用左值引用将使你的代码编译,但可能不是一个好主意。 auto operation = [](std::promise& promise) { promise.set_value(1); }; // ^ Igor is quite right, but for my purposes this worked quite nicely, and is c++1 ...
  • 当C ++编译器看到对std::bind(&f,1,placeholders::_1)调用时,它不知道参数之间的任何关系。 只有在实例化模板时,关系才可见。 要实例化它,编译器需要模板参数。 但是&f是一个重载函数,所以它没有定义类型。 因此,C ++编译器无法实例化模板,因此即使在可以看到任何关系之前编译也会失败。 您可以通过明确指定类型来解决此问题: std::bind(static_cast(&f),1,placeholders::_1); When C++ co ...
  • 问题是std::function需要内部类型是可复制的。 该属性适用于第一个示例( int ),但不适用于第二个示例( std::promise仅为移动)。 请注意,如果您不使用std::function并直接调用lambda,则代码可以正常工作: std::bind([](std::promise& p) { p.set_value(42); }, std::move(p))(); 要使用std::function ,您需要将promise包装到某种包装器中。 标准的std::referenc ...
  • 问题是0在这里是不明确的,它可以被解释为空指针或int,这使得它匹配std::function构造函数和更一般的const T& value (两者都需要转换)。 如果你不想改变接口,你可以创建一个非常简单的函数模板来推断和分配参数。 C ++ 11版本: template int count(U&& value) const { return count_impl(std::forward(value)); } 这是可行的,因为函数模板类型推导规则没有这种歧义,他们 ...
  • 停止使用std::bind 。 这是一个随机的功能和怪癖混乱。 今天的怪癖是, std::bind将接受无限数量的参数并丢弃任何额外的参数。 明天你可能会遇到这样一个事实:将std::bind结果传递给std::bind会产生奇怪的效果。 std::bind被移植到同一时间增加了语言的lambdas。 Lambdas几乎解决了每个问题bind问题,就像清晰的语法一样,并且没有让怪癖bind问题,特别是在auto lambda表达式可用后的C ++ 14之后。 (大多数C ++ 11编译器也支持auto la ...
  • 注意:这个答案假设你已经阅读过为什么从绑定返回的对象忽略额外的参数? std::bind返回的对象不是std::function ; 它是一个未指定类型的对象,它在很多方面与std::function不同; 最重要的是你的情况,它会忽略任何传递给它的额外参数。 如果在绑定表达式中使用最多_2 (例如)的占位符,则只要该数字至少为2,就可以使用任意数量的参数调用返回的对象。 当我调用jj_2a(5,6)时,编译器不会抱怨什么是自动执行? 该函数具有绑定的所有参数。 你正在传递额外的参数; 那些额外的参数被忽略 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)