Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing API declarations & calling of restricted APIs #10498

Open
3 tasks done
cjohn001 opened this issue Mar 16, 2024 · 8 comments
Open
3 tasks done

Missing API declarations & calling of restricted APIs #10498

cjohn001 opened this issue Mar 16, 2024 · 8 comments
Labels
bug-pending-triage Reported bug, pending triage to confirm.

Comments

@cjohn001
Copy link

cjohn001 commented Mar 16, 2024

Issue Description

Hello together,
I just released an upgrade of the IOS version of my app today and got a warning email sent from Apple that I am missing API declarations. Seems like they further restricted API access and now require an update of Info.plist with usage descriptions. I created a new angular project with ns create to see if the templates got an update on the topic already. Seems like this is not the case.

Update: I just tried to figure out which API calls are relevant and found this list:
https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api

Seems like those functions are used in core, i.e. FileSystemAccess (NSFileModificationDate)

Do you already have plans on how to deal with the new IOS requirements and could you provide descriptions for the declarations in the templates where API access is required from Nativescript? Seems like those functions should only be used when explicitly required, hence functionality should be separated from core? Thanks for your help!

Although submission for TestFlight review was successful, you may want to correct the following issues in your next submission for TestFlight review. Once you've corrected the issues, upload a new binary to App Store Connect.

ITMS-91053: Missing API declaration - Your app’s code in the “mnd” file references one or more APIs that require reasons, including the following API categories: NSPrivacyAccessedAPICategoryFileTimestamp. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code. For more details about this policy, including a list of required reason APIs and approved reasons for usage, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api.

ITMS-91053: Missing API declaration - Your app’s code in the “mnd” file references one or more APIs that require reasons, including the following API categories: NSPrivacyAccessedAPICategoryDiskSpace. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code. For more details about this policy, including a list of required reason APIs and approved reasons for usage, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api.

ITMS-91053: Missing API declaration - Your app’s code in the “mnd” file references one or more APIs that require reasons, including the following API categories: NSPrivacyAccessedAPICategoryUserDefaults. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code. For more details about this policy, including a list of required reason APIs and approved reasons for usage, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api.

ITMS-91053: Missing API declaration - Your app’s code in the “mnd” file references one or more APIs that require reasons, including the following API categories: NSPrivacyAccessedAPICategorySystemBootTime. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code. For more details about this policy, including a list of required reason APIs and approved reasons for usage, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api.

Apple Developer Relations

Reproduction

No response

Relevant log output (if applicable)

No response

Environment

OS: macOS 14.4
CPU: (10) arm64 Apple M1 Pro
Shell: /bin/zsh
node: 20.11.1
npm: 10.2.4
nativescript: 8.6.5

# android
java: 11.0.22
ndk: Not Found
apis: Not Found
build_tools: Not Found
system_images: Not Found

# ios
xcode: 15.3/15E204a
cocoapods: 1.15.2
python: 3.12.2
python3: 3.12.2
ruby: 2.7.8
platforms: 
  - DriverKit 23.4
  - iOS 17.4
  - macOS 14.4
  - tvOS 17.4
  - visionOS 1.1
  - watchOS 10.4

Dependencies

"dependencies": {
  "@angular/animations": "17.3.0",
  "@angular/common": "17.3.0",
  "@angular/compiler": "17.3.0",
  "@angular/core": "17.3.0",
  "@angular/forms": "17.3.0",
  "@angular/platform-browser": "17.3.0",
  "@angular/platform-browser-dynamic": "17.3.0",
  "@angular/router": "17.3.0",
  "@apollo/client": "3.9.7",
  "@mnd/external-web-view": "file:../app-plugins/dist/packages/external-web-view/mnd-external-web-view-1.0.1.tgz",
  "@nativescript/angular": "17.0.0",
  "@nativescript/core": "8.6.2",
  "@nativescript/iqkeyboardmanager": "2.1.1",
  "@nativescript/localize": "5.2.0",
  "@nativescript/mlkit-barcode-scanning": "2.1.0",
  "@nativescript/mlkit-core": "2.1.0",
  "@nativescript/secure-storage": "3.0.3",
  "@nativescript/theme": "3.0.2",
  "@nativescript/ui-charts": "0.2.4",
  "apollo-angular": "6.0.0",
  "apollo3-cache-persist": "0.14.1",
  "d3-ease": "3.0.1",
  "graphql": "16.8.1",
  "graphql-tag": "2.12.6",
  "intl": "1.2.5",
  "moment": "2.30.1",
  "nativescript-health-data": "file:../app-plugins-customized/nativescript-health-data/publish/package/nativescript-health-data-2.0.0.tgz",
  "nativescript-oauth2-ext": "file:../app-plugins-customized/nativescript-oauth2-ext/publish/package/nativescript-oauth2-ext-3.0.3.tgz",
  "nativescript-sqlite": "2.8.6",
  "nativescript-sqlite-commercial": "file:../app-plugins-customized/commercial-sqlite/nativescript-sqlite-commercial-1.8.0.tgz",
  "nativescript-sqlite-encrypted": "file:../app-plugins-customized/commercial-sqlite/nativescript-sqlite-encrypted-1.6.0.tgz",
  "nativescript-ui-calendar": "15.2.3",
  "nativescript-ui-gauge": "15.2.3",
  "qs": "npm:[email protected]",
  "rxjs": "7.8.1",
  "util": "0.12.5",
  "uuidjs": "5.0.1",
  "zone.js": "0.14.4"
},
"devDependencies": {
  "@angular-devkit/build-angular": "17.3.0",
  "@angular/compiler-cli": "17.3.0",
  "@graphql-codegen/cli": "5.0.2",
  "@graphql-codegen/fragment-matcher": "5.0.2",
  "@graphql-codegen/introspection": "4.0.3",
  "@graphql-codegen/typescript": "4.0.6",
  "@graphql-codegen/typescript-apollo-angular": "4.0.0",
  "@graphql-codegen/typescript-operations": "4.2.0",
  "@nativescript/android": "8.6.2",
  "@nativescript/ios": "8.6.4",
  "@nativescript/types": "8.6.1",
  "@nativescript/webpack": "5.0.18",
  "@ngtools/webpack": "17.3.0",
  "@types/d3-ease": "3.0.2",
  "@types/intl": "1.2.2",
  "@types/lodash": "4.17.0",
  "@types/node": "20.11.28",
  "keycloak-request-token": "0.1.0",
  "rimraf": "5.0.5",
  "sass": "1.72.0",
  "ts-node": "10.9.2",
  "typescript": "5.2.2"
}

Please accept these terms

@cjohn001 cjohn001 added the bug-pending-triage Reported bug, pending triage to confirm. label Mar 16, 2024
@cjohn001 cjohn001 changed the title Missing API declarations Missing API declarations & calling restricted APIs Mar 16, 2024
@cjohn001 cjohn001 changed the title Missing API declarations & calling restricted APIs Missing API declarations & calling of restricted APIs Mar 16, 2024
@cjohn001
Copy link
Author

Update: Seems like I could reduce the issue to an issue with mlkit NativeScript/mlkit#62
Will leave this one open till it is clear

@rob4226
Copy link
Contributor

rob4226 commented Apr 3, 2024

It appears we have to add a PrivacyInfo.xcprivacy file using the reasons listed in the Apple docs.

I haven't tried it yet but hopfully adding the privacy manifest to App_Resources/iOS/PrivacyInfo.xcprivacy will work.

I guess the other question is, should NativeScript CLI add this automatically to new projects? Or, should the developer be responsible bc the reasons for the API use could be different for each app.

Apple will require this for new apps, and updates starting May 1, 2024.

@cjohn001
Copy link
Author

cjohn001 commented Apr 3, 2024

@rob4226 my understanding is the privacy file needs to be added to the libraries that are linked independent of the app itself. Google did this for MLKit already, hence, I believe an upgrade of the MLKit lib is required for the plugin.

But please correct me if I am wrong. I have never worked with privacy files so far. Would be great if someone could provide directions how to resolve the issue.

@farfromrefug
Copy link
Collaborator

@cjohn001 you are right. And N might need one too for ApplicationSettings. I added it in App_Resources/iOS/ and it seems to have worked.

@cjohn001
Copy link
Author

cjohn001 commented Apr 3, 2024

@farfromrefug could you please share the privacy file? No idea what needs to go in for MLKit. So if I understood right:

  1. Update of MLKit required (library)
  2. Also add privacy file to application

@farfromrefug
Copy link
Collaborator

@cjohn001

<?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>NSPrivacyAccessedAPITypes</key>
    <array>
        <dict>
            <key>NSPrivacyAccessedAPIType</key>
            <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
            <key>NSPrivacyAccessedAPITypeReasons</key>
            <array>
                <string>CA92.1</string>
            </array>
        </dict>
    </array>
   </dict>
</plist>

@felixkrautschuk
Copy link
Contributor

It is important to name the file PrivacyInfo.xcprivacy, this should be changed in the Blog post, too.
There it is named Privacy.xcprivacy, but this will NOT work.

@NathanWalker
Copy link
Contributor

@felixkrautschuk thanks for heads up, just updated the name in the post ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-pending-triage Reported bug, pending triage to confirm.
Projects
None yet
Development

No branches or pull requests

5 participants