iOS Question aps-environment key ios 10 and b4i bridge

fabton1963

Member
Licensed User
Longtime User
Good morning,
I spent the last three days trying to solve an issue.
My app has been distributed on the apple store since last year and everything went well until last month when, after the ios 10.1 upgrade, the application began crashing when loaded on upgraded devices.
My application recives push messages sent by a php script.
So I upgraded my b4i to version 3.5 to debug the application.
I rebuilt all expired apple certificates: wildcard developer, push developer, distribution and so on
Using the new wildcard I built b4i bridge app, installed and run it on my ipad with IOS 9.3.5 with no problem;The app registers on APN and receives the PushToken, my php script sends push messages using the APN and the app receives it.
I tried the same with an old iphone IOS 7.3: the bridge works, I can debug my application but cannot register in APN and I get
B4IExceptionWrapper: Error Domain=NSCocoaErrorDomain Code=3000 no authorization string for 'aps-environment'
After this I thought I could debug my app with IOS 10 or greater and, as suggested, I added the following lines in my code
B4X:
  #ATSEnabled: True
   ' attenzione usa string release per la versione definitiva
   #Entitlement: <key>aps-environment</key><string>development</string>

   '#If RELEASE
     '#ProvisionFile: distribuzione_cup4med.mobileprovision 
     '#CertificateFile: ios_distribution.cer
   '#Else
     ' vecchia versione prima di entiEntitlement
     #ProvisionFile: sviluppatore.mobileprovision
     #CertificateFile: ios_development.cer  
     ' nuova versione per bridge
     '#ProvisionFile: cup4med_bridge.mobileprovision
     '#CertificateFile: ios_development.cer
   '#END IF
but when I try to build B4i bridge I get the following error
Check dependencies
Provisioning profile "sviluppatore" doesn't include the aps-environment entitlement.
Code signing is required for product type 'Application' in SDK 'iOS 10.1'


Error: ** BUILD FAILED **
I also tried to build a non wildcard certificate provision profile cup4med_bridge.mobileprovision, with it I can build a bridge application but I cannot debug mine.
Wildcard certificates cannot be used with push services so How may I debug my application on IOS 10.1?
 

fabton1963

Member
Licensed User
Longtime User
If I comment the line
<key>aps-environment</key><string>development</string>
I cannote debug my app, when the app to register in aps I get the following error:
Error getting token: <B4IExceptionWrapper: Error Domain=NSCocoaErrorDomain Code=3000 "non è stata trovata nessuna stringa di autorizzazione “aps-environment” valida per l'applicazione" UserInfo={NSLocalizedDescription=non è stata trovata nessuna stringa di autorizzazione “aps-environment” valida per l'applicazione}>
 
Upvote 0

fabton1963

Member
Licensed User
Longtime User
Using aps-environment if I try to build bridge application I get:

Sending data to remote compiler. Error
Out: Build settings from command line:
ARCHS = armv7
CODE_SIGN_IDENTITY = iPhone
CONFIGURATION_BUILD_DIR = /Users/administrator/Documents/UploadedProjects/<user id>/Payload
OTHER_CODE_SIGN_FLAGS = --keychain <user id>
PRODUCT_NAME = CUP4med
PROVISIONING_PROFILE = 8ef24323-69ce-4ff4-a6f7-6ac17aa503b6

=== BUILD TARGET B4iProject OF PROJECT B4iProject WITH CONFIGURATION Release ===

Check dependencies
Provisioning profile "sviluppatore" doesn't include the aps-environment entitlement.
Code signing is required for product type 'Application' in SDK 'iOS 10.1'


Error: ** BUILD FAILED **
 
Upvote 0

fabton1963

Member
Licensed User
Longtime User
Yes,
if I add the line
#Entitlement: <key>aps-environment</key><string>release</string>
or
#Entitlement: <key>aps-environment</key><string>development</string>

the compiler returns

Check dependencies
Provisioning profile "sviluppatore" doesn't include the aps-environment entitlement.
Code signing is required for product type 'Application' in SDK 'iOS 10.1'
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
Yes,
if I add the line
#Entitlement: <key>aps-environment</key><string>release</string>
or
#Entitlement: <key>aps-environment</key><string>development</string>

the compiler returns

Check dependencies
Provisioning profile "sviluppatore" doesn't include the aps-environment entitlement.
Code signing is required for product type 'Application' in SDK 'iOS 10.1'

It is not related but
#Entitlement: <key>aps-environment</key><string>release</string>

release in this code should be production i think.
 
Upvote 0

fabton1963

Member
Licensed User
Longtime User
So I cannot debug my application push feature, without <key>aps-environment</key> declaration my app cannot register into APN.
May be I make a mistake but my app now cannot send or receive push and I didn't change anything else than a label value.
 
Upvote 0
Top