Debugging iOS push

81 views
Skip to first unread message

nir...@nvsoft.com

unread,
Apr 10, 2013, 10:44:45 AM4/10/13
to codenameone...@googlegroups.com
Hi Shai,

I have added code in App to registerPush as follows:

                Hashtable meta = new Hashtable(1);
                meta.put(com.codename1.push.Push.GOOGLE_PUSH_KEY, 
                        Configuration.getInstance().getGooglePushKey());
                Display.getInstance().registerPush(meta, false);

Now, it seems to be able to register for push on Google Android devices, however when I am testing the same on iOS iPhone device, it is not calling my callback for the registeredForPush method.  How can I debug this further? Is there a way to know, whether my client's call to registerPush on iOS was successful or not?

Thanks,
Nirmal

Shai Almog

unread,
Apr 10, 2013, 1:03:47 PM4/10/13
to codenameone...@googlegroups.com, nir...@nvsoft.com
Are you using the sandbox or production?
Is your app key complete and enabled for push (no star extensions etc.).

Nirmal Juthani

unread,
Apr 10, 2013, 9:49:28 PM4/10/13
to Shai Almog, codenameone...@googlegroups.com
Also even after I have called the registerPush method, my app is not shown in the iPhone->settings->notification app list.

It also did not ask during app startup whether you want push notification or not.

Sent from my iPhone

nir...@nvsoft.com

unread,
Apr 11, 2013, 12:10:09 AM4/11/13
to codenameone...@googlegroups.com, nir...@nvsoft.com
Looks like my reply to post was ignored by Google groups. Here's it again:

I am using the sandbox env and the key is complete and enabled for push(no star ext etc).

Thanks,
Nirmal

Shai Almog

unread,
Apr 11, 2013, 1:56:24 AM4/11/13
to codenameone...@googlegroups.com, nir...@nvsoft.com
I can say that I spent ages going back and forth on this with the provisioning profile and the proper certificates in place.
If you have push notification properly enabled on a device that isn't jailbroken (push sometimes fails on those devices) then I'm not really sure what is going on.  I've helped some of our enterprise developers in this process and its painful but strait forward.

nir...@nvsoft.com

unread,
Apr 11, 2013, 6:57:10 AM4/11/13
to codenameone...@googlegroups.com, nir...@nvsoft.com
Hi Shai,

I followed the Apple trouble shooting guide and found that correct entitlements are there in the provisioning profile which is used when server build is sent to the codenameone. The entitlements in my provisioning profile are given below:

<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>KF4G994665.com.nvsoft.s2pay</string>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.default-data-protection</key>
<string>NSFileProtectionComplete</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>KF4G994665.*</string>
</array>
</dict>
<key>ExpirationDate</key>
<date>2014-04-10T07:26:20Z</date>
<key>Name</key>
<string>S2Pay App Store Dev Profile</string>

However, the ipa file which I receive from the codenameone build server does not have any APS entitlements and it only shows the following:

Nirmal-Juthanis-MacBook-Pro-4:10April2013 nirmal$ codesign -d --entitlements :- "Payload/S2PayApp.app"
Executable=/Users/nirmal/tmp/10April2013/Payload/S2PayApp.app/S2PayApp
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
   <dict>
       <key>application-identifier</key>
       <string>KF4G994665.com.nvsoft.s2pay</string>
       <key>keychain-access-groups</key>
       <array>
           <string>KF4G994665.com.nvsoft.s2pay</string>
       </array>
       <key>get-task-allow</key>
       <true/>
   </dict>
</plist>

Somehow the codenameone build server does not seem to be adding the APS entitlements in the ipa file. Can you please check that?

Thanks,
Nirmal

Shai Almog

unread,
Apr 11, 2013, 1:34:15 PM4/11/13
to codenameone...@googlegroups.com, nir...@nvsoft.com
Sorry about that, its entirely my fault!
Forgot to document this (although it should be in the Kitchen Sink Demo) you need to define the build argument ios.includePush to true for push to work on iOS. Its one of those things you do once and forget about completely every time.

Nirmal Juthani

unread,
Apr 11, 2013, 2:03:47 PM4/11/13
to Shai Almog, codenameone...@googlegroups.com
Thanks, never realized that flag was needed.

Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages