IOS Provisioning Profile and Push Notification on New Device - objective-c

I can send push notification to an IOS device (IOS 5.1 IPAD 3rd gen) and handle notifications etc.. So it works quite well.
Now I have to use another device(IOS 5.1 IPAD 3rd gen), on organizer by right clicking I add my device to provisioning profile I can install my app to device but I can not send push notifications because I can not get device's token.
I guess it is because when I right click and add device to my provisioning profile It only adds the iOS Team Provisioning Profile rather then myApp Development Profile
On apples developer portal I have:
On My Organizer In Library-->Provisioning Profiles
On my teams
And I handle error code on push Notification:
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
NSLog(#"Failed to get token, error: %#", error);
}
Error Is: Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0xxxxxxx {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}
In case error is because provisioning profile:
How can add that Paper Developement profile to my device?
or
How can I learn device token and send push notification without creating provisioning profile all over?
Thanks in advance

I had similar issues before so I will list your possible issues,
Firstly do not use a provisioning profile with a wild card it is highly possible that your IOS Team Provisoning Profile includes a wild card. So just go to your device's provisioning profile on organizer and delete that IOS Team Provisoning Profile
Secondly go to your provisoning profiles on developer.apple and click edit as on your second picture in question. When you click edit you will see Modify click on that
and add your device by checking squares like below:
Click save and download new profile, now go to your provisioning profiles on your organizer and delete previous Pape Developement Profile. Double click your downloaded profile or click refresh on your organizer. Now drag and drop proviosinig profile to your device on organizer.
Finally if none of above solves your problem that means probably your bundle identifier and your app id does not much in this case check this answer
Hope you solve this issue....

For me it was just changing the bundle identifier and code signing identity to IOS Developer. The bundle identifier Changing it back and forth and building between changes did the trick (not sure if this step necessary). Not sure what it really was. Hope this helps someone someday, probably not.

Related

ERROR ITMS-90163: "Invalid Code Signing Entitlements - expo build

I want to upload my apps using Expo to app store connect. Unfortunately, it failed and return this message
ERROR ITMS-90163: "Invalid Code Signing Entitlements. The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. The bundle contains a key that is not included in the provisioning profile: 'com.apple.developer.icloud-services' in 'Payload/ExpoKitApp.app/ExpoKitApp'."
I already tried couple ways to build the apps by:
let expo handle the certificate
Manually generate the provisioning profile and certificate itself
Any thoughts to solve this problem?
notes: I already defined a unique bundle identifier name as well and already detected on bundle id in My App on appstore connect
Thanks :)
For anyone who finds this now. If you are having this problem in the expo managed workflow, you need to do 2 things.
First, in your apple developer account dashboard you must navigate to Certificates, Identfiers and Profiles.
In Identifiers, you must edit the identifier and check the box next to ICloud (or any other of the features listed there that you want, e.g. Associated Domains for Universal Links)
Second, you must build with a new provisioning profile using:
expo build:ios -t archive --clear-provisioning-profile
You may manually provide a new provisioning profile or let expo handle it. If you choose not to revoke the previous provisioning profile, you should choose to use a new one when asked.

Error with 'com.apple.developr.aps-environment' when validating mac application on xcode

In an application I made for Mac, when I ran the process for validating the archive, it came up with the error:
The archived application has entitlements that require Mac App Store distribution.
The invalid entitlements were:
com.apple.developer.aps-environment.
I looked at this link: Enabling Push Notifications and the entitlement, I think, is in relation to the push notifications.
I tried adding the
com.apple.developer.aps-environment
to my entitlements file as a boolean set to YES, but the error still came up.
How can I fix this?
It looks like you're maybe trying to sign the app for distribution outside the App Store, and Xcode is telling you it's not going to let you do that because you're using App Store only features.
I'm no expert in signing stuff, but to get my last app to submit I signed it with the "3rd Party Mac Developer Application:..." identity, not my "Developer ID:" identity. The latter is only for when you're distributing apps directly to customers from your own website.
It's not a boolean. It's a string that's either 'development' or 'production'. It's also only for apple store only.

No identifiers are available for signing (Xcode)

I've tried to do App Store Submission, it couldn't be completed as the error
show "No identities are available for signing".
I checked out from the forum and followed step by step, it still can't
fix the problem.
Do you have any idea?
Go to developer.apple.com, download the distribution certificate and install that on you mac. After that you will be able to sign your app.
Check to see if your Provisioning Profiles have expired. I already had distribution provisioning profiles created but they had just recently expired. The error message xCode was giving just said "No identities were available for signing" even though the private/public keys were correctly in the Key Store. To fix I just did the following:
From the iOS Provisioning Portal, select "Provisioning" on the left
Under "Provisioning Profiles" select "Distribution" (this is where I could see that the provisioning profiles had expired
Click on the expired Provisioning Profile
Click "Edit"
Select the Certificate you want to use for the Provisioning Profile
Click "Generate"
Click "Download"
Open the file (it should launch xCode and add it to the Organizer)
After this I was able to submit the update to the App Store no problem. They really need a better error message.

Push notifications not asking permission when user loads app

Hi I have just released my app update with push notifications added into it. I was worried that it would not work properly so I did a bunch of testing. First with just a development certificate and then a production certificate using adhoc. Both ended up working and I was pleased when the adhoc worked.
Anyways the update has been live for about 8 hours now and for some reason push isn't working. I checked with my friend and have realized that the user is not being asked whether he wants to accept push notifications from my app. Which means when the token gets sent to my server, its appearing as (null). I have no idea why this is happening. When he goes into device settings --> notifications ---> my app does not appear on any of the lists (receiving push notifications or not receiving).
This is the code in my delegate that should trigger the request:
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
If anyone knows why this is happening, input would be much appreciated. Thanks!
We thought we were having this same issue but found out that the app was actually working correctly. The user is only prompted once even if they uninstall and reinstall the app.
We were testing it by uninstalling the app and then reinstalling. iOS would remember how we had responded previously on that device and would not prompt again leading us to think there was a problem.
We found the best way to test is with the simulator and doing a "Reset Content and Settings".
After configuring your app for push notifications and generating your SSL certificates you must also generate new provisioning profiles.
The developer portal displays this message on the App ID configuration page:
After you have generated your Client SSL certificate, create a new provisioning profile containing the App ID you wish to use for notifications.
If you did not update your App Store provisioning profile after setting up push the OS will not provide you with a push token.
If this is your problem you just need to generate a new App Store distribution profile and submit a recompiled version signed with that profile.

Push notification not working

I am trying to send push notifications to myself.
I have copied the code from Apple. But I am getting the error no valid 'aps-environment' entitlement string found for application.
I made a new project with the same code (without adding entitlements.plist)and it's working fine.
so it's not the problem of my provisioning profile or my code, then what is?
Can someone tell me why it isn't working on my main project?
thanks in advance
This means that the provisioning profile used to build the application does not have push notifications enabled. Push notifications must be enabled for that application ID in the iTunes Developer Portal.
If you’ve already enabled push notifications and still receive this error, it might be because you enabled push notifications after the provisioning profile was created. In this case, the profile will not have the required push notification settings, and must be regenerated.
To regenerate the provisioning profile, find it in the iTunes Developer Portal, and click Edit->Modify and save it. When you download the new profile, we recommend removing the existing profile from the device and XCode before installing the new one. Many developers continue to report problems unless they do this step.