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
最满意答案
停止使用
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 passingstd::bind
result tostd::bind
does strange magic.
std::bind
was ported over toboost
at the same time lambdas where added to the language. Lambdas solve almost every problembind
does in just as clear syntax and fails to have the myraid of quirksbind
does, especially post C++14 whenauto
lambdas are available. (Most C++11 compilers also supportedauto
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 ofstd
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); 这比实际写一个函子类更简洁。 在您链接的文章中还有其他示例。 当您需要将函子传递给某种算法时,您通常会使用它。 你有一个函数或函数, 几 ...
-
为什么我不需要std :: move到std :: bind'ed函数?(Why don't I need to std::move to a std::bind'ed function?)[2023-03-24]
使用libc ++时,我得到了相反的结果。 std::unique_ptrnothing; 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引用。 以上也意 ... -
无法将std :: bind的结果转换为std :: function(Cannot convert result of std::bind to std::function)[2022-09-17]
绑定对象作为左值传递,并且无法复制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 ... -
为什么std :: bind无法解析多个参数的函数重载?(Why std::bind cannot resolve function overloads with multiple arguments?)[2023-07-21]
当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 :: function“overloads”(Passing result of std::bind to std::function “overloads”)[2023-10-20]
停止使用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)时,编译器不会抱怨什么是自动执行? 该函数具有绑定的所有参数。 你正在传递额外的参数; 那些额外的参数被忽略 ...