How to debug APNS on iphone from xcode - xcode

My iPhone app is able to register for APNS remote notifications when I run it via an adhoc distribution. So I know that my adhoc provisioning profile is correct.
But I'd really to debug the app from xCode, runnin on my iPhone. In that case, I know that the app will use the APNS sandbox, which is fine. But when running in this mode, when the app calls registerForRemoteNotificationTypes, it gets the dreaded error "no valid 'aps-environment' entitlement string found for application".
I assume that I should be using my developer code signing certificate when debugging the app on the iPhone from xCode. Is that correct? What stupid configuration thing I am missing that is causing the error?

To be able to debug the application your server APNS should be configured with the Developer APNS certificated instead of the Distribution APNS certificate.
Because on Debug you're signing the application with the Developer certificate.
I hope it helps.

no valid 'aps-environment' entitlement string found for application - error is because, APNS is not enabled on your development provisioning profile.
To make sure your provisioning profile is APS enabled - Open your XXXXX.mobileprovision in text edit & search 'aps-environment'. You should be able to see something like below.
<key>aps-environment</key>
<string>development</string>

Related

Unable to simulate iOS application on my device. "Unable to verify APP"

I'm trying to build and simulate my app from xcode to my device but I'm struggling with an error that always show up when I run my application.
Error:
Could not launch “AppName” Domain: IDEDebugSessionErrorDomain Code: 3 Failure Reason: The operation couldn’t be completed. Unable to launch org.reactjs.native.example.AppName because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user.
When I tap the app button on my phone it says:
"Unable to verify app. An internet connection is required to verify the trust of the developer ... This app will not be available until verified."
I already trusted the developer on Settings > General > VPN & Device Management but even when I trust it the app still saying "Not verified"
My app runs normally on xcode simulator.
iOS version: 16.2 Xcode version: 14.1 macOS: Ventura 13.0.1
I already trusted the developer on Settings > General > VPN & Device Management but even when I trust it the app still saying "Not verified"
I've solved it. I went into ~/Library/MobileDevice/Provisioning Profiles and cleared the old profiles. At the same time I restarted my iOS device. Upon restart I was able to go to preferences, and trust the development cert, and also verify the app successfully. I was able to run it from Xcode after this.

Deploy to iPhone Device doesn't work with Xamarin.iOS, "No iOS signing identities match"

I'm trying to deploy my app to my iPhone device in order to debug it (Automatic provision) but it says "No iOS signing identities match the specified provisioning profile". I am able to deploy apps from Xcode to the iPhone device.
Please make sure that your bundle identifier in your app match your app id on the portal.
The app id listed on the portal should match (either exactly or with a wildcard *). Then in your info.plist, it should match your CFBundleIdentifier. That's what it uses to match provisioning profiles.
For more detail, you can check: https://learn.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/automatic-provisioning?tabs=windows .
Some times VS cannot create certificate automatically. It can be solved by creating new Xcode project using your bundle ID and make sure it run from Xcode debug
We have just faced this issue today, our Development Certificate has expired.
Regenerate a new certificate and new provisioning profiles resolved the issue

Visual Studio App Center Rejects Provisioning File and Signing Cert Combo

I am attempting to set up an iOS build and distribution flow on Visual Studio App Center for my React Native application using the bare expo workflow. I am running into an issue where App Center rejects my iOS provisioning profile and signing certificate due to the error: "Provisioning profile 'profile name' does not include the provided signing certificate"
This seems like a cryptic error since I know that my provisioning profile does contain the signing certificate that I used and I have verified this in XCode. I have been able to build and sign XCode builds using manual signing with the profile and cert, but when I try to add them to the "Sign Builds" step of App Center builds I get the error mentioned above.
I have attempted to find similar issues to this on various forums and on StackOverflow, but have been unsuccessful in finding a successful solution for me. Here are links to a few of the solutions which I have tried:
AppCenter Build error "Provisioning profile does not include signing certificate apple push services"
https://forums.xamarin.com/discussion/153425/appcenter-build-error-provisioning-profile-does-not-include-signing-certificate-apple-push-services
I would be happy to provide any further information if it is helpful.
Thanks in advance.
Image of Error received on App Center
problem for me was that my distribution certificate expired. so I had to create a new one and edit the provisioning profile to hook it up with the new certificate. with this set up App Center gave me the exact same error even though I was able to sign my app on my local machine with the same cert and provisioning profile.
Solution was I had to create a completely new provisioning profile instead of editing my old one.

APNS Invalid token error using Parse

I have an iOS app in Xcode 7 that used Push Notifications via Parse in development mode. I had to format my Mac’s hard drive and reinstall El Capitan and Xcode. Running my same old code, all my push notifications now get a “APNS Invalid token” error. I’m assuming the error is due to changes on my Mac.
I have revoked and replaced my APN certificate at the Apple Member Center, downloaded the new certificate, put in it my keychain, exported it to a p12, deleted my old certificate at Parse and installed the new p12 file. I also edited and renewed my Provisioning Profile at Apple.
I’m still getting the Invalid token error from Apple. I haven’t changed any other settings so I don’t believe I am trying to use a development token against Apple’s production Push notifications service, or vise-versa.
Can anyone suggest how to correct this? Thanks!
Possibly because Xcode cannot find a correct provisioning profile linked with with your app Bundle identifier and it is relying on its default profile.
In the menu go to: Xcode > Preferences > Accounts
Then click on View Details.. button to see all the provisioning profile associated with your account. Make sure you download them all so that Xcode can find them on your disk. Alternatively you can download your provisioning profiles from member centre on your mac and double click on them so that Xcode loads them internally.
I had to re-enable Push Notifications in the apps Capabilities.

"Message from debugger: Terminated due to code signing error" when debugging a Mac app?

I'm writing a Mac app in the sandbox, and can't seem to get code signing to work. I've selected "Developer ID" from the Info tab for my target, and I've tried letting Xcode set up my provisioning profile automatically as well as creating the profile myself. The app builds without any errors or warnings, but when I try to "build and run," it gives me the following error:
In console.app, I noticed I was getting the following message:
3/5/15 4:46:37.151 PM taskgated[73]: killed com.nateparrott.Boxcar[pid 27408] because its use of the com.apple.developer.ubiquity-container-identifiers entitlement is not allowed (error code -67050)
It turns out that the default entitlements file in my project included an empty list of iCloud container, which caused the sandbox to think the app needed iCloud permissions (which weren't included in the default provisioning profile). Removing the iCloud entry from the entitlements file solved the problem.
Try to regenerate your certificates from the Dev Center. This happens most of the times when you switch to a new mac or after upgrading to a newer OS X version.
You have downloaded and installed your cert (in Keychain Access) from the portal. If you created the cert today on the same Mac you're trying to run it on this won't be your issue.
Your cert from above is in the provisioning profile you imported into XCode.
You actually imported your provisioning profile into XCode. It should be selectable form your Build Settings drop-down.
The bundle identifier you created in the portal matches what you have designated in your project under the Target Info.
I tried Setting Build Settings->code signing identity to "Mac Developer" and Provisioning Profile to "Automatic". The debugger worked fine after that.
This also can happen when debugging on iOS Simulator, when developing for Mac Catalyst, when ENABLE_HARDENED_RUNTIME set to YES.
Below Xcode configuration helps to avoid this error:
ENABLE_HARDENED_RUNTIME[sdk=macosx*] = YES
ENABLE_HARDENED_RUNTIME[sdk=iphonesimulator*] = NO
ENABLE_HARDENED_RUNTIME[sdk=iphoneos*] = NO
modify targets>Build Setting>code signing identity to your sign development.

Resources