<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 27, 2013 at 7:38 AM, Matthias Wessendorf <span dir="ltr"><<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>yes. There is a security branch:</div><div><a href="https://github.com/matzew/aerogear-push-ios-registration/tree/security" target="_blank">https://github.com/matzew/aerogear-push-ios-registration/tree/security</a><br>
</div><div><br></div><div><br></div><div>Please update your Podfile, like this:</div><div>pod 'AeroGearPush', :git => '<a href="https://github.com/matzew/aerogear-push-ios-registration.git" target="_blank">https://github.com/matzew/aerogear-push-ios-registration.git</a>', :branch => 'security'<br>
</div></div></blockquote><div><br></div><div><br></div><div style>and run "pod update" afterwards :-)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>
</div><div><br></div><div><br></div><div>When you register the iOS Variant, it gives you a variantID and a secret. In your iOS, you need to set that (like you are already doing):</div><div><br></div>
<div>...<br><span> [clientInfo </span><span>setMobileVariantID</span><span>:</span>@"some_id"<span>];<br></span><span> [clientInfo </span><span>setMobileVariantSecret</span><span>:</span>@"some_secret"<span>];<br>
</span>...</div><div><br></div><div><br></div><div>Greetings,</div><div>Matthias</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Thu, Jun 27, 2013 at 1:02 AM, Yavuz Selim YILMAZ <span dir="ltr"><<a href="mailto:yavuzsel@buffalo.edu" target="_blank">yavuzsel@buffalo.edu</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div style="word-wrap:break-word">Hi all,<div><br></div><div>After registering an application and iOS variant on my push server following the instructions on <a href="https://github.com/aerogear/aerogear-unified-push-server" target="_blank">https://github.com/aerogear/aerogear-unified-push-server</a>, I am implementing the following method on my iOS client:</div>
<div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">// Here we need to register this "Mobile Variant Instance"</div><div style="margin:0px;font-size:11px;font-family:Menlo">
- (<span style="color:#bb2ca2">void</span>)application:(<span style="color:#703daa">UIApplication</span> *)application didRegisterForRemoteNotificationsWithDeviceToken:(<span style="color:#703daa">NSData</span> *)deviceToken {</div>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"> <br></p><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#000000"> </span>// we init our "Registration helper:</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> <span style="color:#4f8187">AGDeviceRegistration</span> *registration =</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"> <br></p>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#000000"> </span>// WARNING: make sure, you start JBoss with the -b 0.0.0.0 option, to bind on all interfaces</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">
<span style="color:#000000"> </span>// from the iPhone, you can NOT use localhost :)</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#000000"> [[</span><span style="color:#4f8187">AGDeviceRegistration</span><span style="color:#000000"> </span><span style="color:#3d1d81">alloc</span><span style="color:#000000">] </span><span style="color:#31595d">initWithServerURL</span><span style="color:#000000">:[</span><span style="color:#703daa">NSURL</span><span style="color:#000000"> </span><span style="color:#3d1d81">URLWithString</span><span style="color:#000000">:</span>@"<a href="http://10.193.23.8:8080/pushee/" target="_blank">http://10.193.23.8:8080/pushee/</a>"<span style="color:#000000">]];</span></div>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"> <br></p><div style="margin:0px;font-size:11px;font-family:Menlo"> [registration <span style="color:#31595d">registerWithClientInfo</span>:^(<span style="color:#bb2ca2">id</span><<span style="color:#4f8187">AGClientDeviceInformation</span>> clientInfo) {</div>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"> <br></p><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#000000"> </span>// Use the Mobile Variant ID, from your register iOS Variant</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> <span style="color:#008400">//</span></div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#000000"> </span>// This ID was received when performing the HTTP-based registration</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#000000"> </span>// with the PushEE server:</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)">
<span style="color:#000000"> [clientInfo </span><span style="color:#31595d">setMobileVariantID</span><span style="color:#000000">:</span>@"MY_VARIANT_ID"<span style="color:#000000">];</span></div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">
<br></p><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"> <br></p><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#000000"> </span>// apply the token, to identify THIS device</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> [clientInfo <span style="color:#31595d">setDeviceToken</span>:deviceToken];</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"> <br>
</p><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#000000"> </span>// --optional config--</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">
<span style="color:#000000"> </span>// set some 'useful' hardware information params</div><div style="margin:0px;font-size:11px;font-family:Menlo"> <span style="color:#703daa">UIDevice</span> *currentDevice = [<span style="color:#703daa">UIDevice</span> <span style="color:#3d1d81">currentDevice</span>];</div>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"> <br></p><div style="margin:0px;font-size:11px;font-family:Menlo"> [clientInfo <span style="color:#31595d">setOperatingSystem</span>:[currentDevice <span style="color:#3d1d81">systemName</span>]];</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> [clientInfo <span style="color:#31595d">setOsVersion</span>:[currentDevice <span style="color:#3d1d81">systemVersion</span>]];</div><div style="margin:0px;font-size:11px;font-family:Menlo">
[clientInfo <span style="color:#31595d">setDeviceType</span>: [currentDevice <span style="color:#3d1d81">model</span>]];</div><p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"> <br></p>
<div style="margin:0px;font-size:11px;font-family:Menlo"> } <span style="color:#31595d">success</span>:^() {</div><div style="margin:0px;font-size:11px;font-family:Menlo"> <span style="color:#008400">//</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> } <span style="color:#31595d">failure</span>:^(<span style="color:#703daa">NSError</span> *error) {</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)">
<span style="color:#000000"> </span>// did receive an HTTP error from the PushEE server ???</div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#000000"> </span>// Let's log it for now:</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(209,47,27)"><span style="color:#000000"> </span><span style="color:#3d1d81">NSLog</span><span style="color:#000000">(</span>@"PushEE registration Error: %@"<span style="color:#000000">, error);</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> }];</div><div style="margin:0px;font-size:11px;font-family:Menlo">}</div><div style="margin:0px;font-size:11px;font-family:Menlo"><br></div><div>
<div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
The registerWithClientInfo call fails with this error:</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
<br></div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
PushEE registration Error: Error Domain=AFNetworkingErrorDomain Code=-1011 "Expected status code in (200-299), got 401" UserInfo=0x1d5522b0 {NSLocalizedRecoverySuggestion=Unauthorized Request, AFNetworkingOperationFailingURLRequestErrorKey=<NSMutableURLRequest <a href="http://10.193.23.8:8080/pushee/rest/registry/device" target="_blank">http://10.193.23.8:8080/pushee/rest/registry/device</a>>, NSErrorFailingURLKey=<a href="http://10.193.23.8:8080/pushee/rest/registry/device" target="_blank">http://10.193.23.8:8080/pushee/rest/registry/device</a>, NSLocalizedDescription=Expected status code in (200-299), got 401, AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x1d549310>}</div>
<div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
<br></div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
Do you have any idea/suggestion to solve my problem? Your help is appreciated.</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
<br></div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
Thanks and regards,</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
<br>---</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
Yavuz Selim Yilmaz</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
SUNY at Buffalo</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
Computer Science and Engineering</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
PhD Candidate</div>
</div>
<br></div></div><br></div></div>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><span class="HOEnZb"><font color="#888888"><br></font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br>
<br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br>
<br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div>