René's URL Explorer Experiment


Title: ns embed ios: finish the host metadata setup (duplicate -sectcreate flags, missing metadata file, hardcoded arch) · Issue #6168 · NativeScript/nativescript-cli · GitHub

Open Graph Title: ns embed ios: finish the host metadata setup (duplicate -sectcreate flags, missing metadata file, hardcoded arch) · Issue #6168 · NativeScript/nativescript-cli

X Title: ns embed ios: finish the host metadata setup (duplicate -sectcreate flags, missing metadata file, hardcoded arch) · Issue #6168 · NativeScript/nativescript-cli

Description: Is your feature request related to a problem? Please describe. ns embed ios (added in #5803) leaves the host project's metadata setup half-finished. This issue tracks the follow-ups. Context: NativeScript/ios#488 changes the runtime so t...

Open Graph Description: Is your feature request related to a problem? Please describe. ns embed ios (added in #5803) leaves the host project's metadata setup half-finished. This issue tracks the follow-ups. Context: Nativ...

X Description: Is your feature request related to a problem? Please describe. ns embed ios (added in #5803) leaves the host project's metadata setup half-finished. This issue tracks the follow-ups. Context: N...

Opengraph URL: https://github.com/NativeScript/nativescript-cli/issues/6168

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ns embed ios: finish the host metadata setup (duplicate -sectcreate flags, missing metadata file, hardcoded arch)","articleBody":"### Is your feature request related to a problem? Please describe.\n\n`ns embed ios` (added in #5803) leaves the host project's metadata setup half-finished. This issue tracks the follow-ups.\n\nContext: NativeScript/ios#488 changes the runtime so that, when `Config.MetadataPtr` is nil, it reads the `__DATA,__TNSMetadata` section of the host executable. Until that lands, the section `ns embed ios` links into the host is never read (embedded apps run on the default metadata baked into `NativeScript.framework`), which is why these problems have gone unnoticed. Once it lands, the section becomes the metadata the embedded app actually runs on.\n\nThe relevant block is in [`lib/services/ios-project-service.ts`](https://github.com/NativeScript/nativescript-cli/blob/e157c9fb8b3ef9d8e79635e6b5520805b3790b04/lib/services/ios-project-service.ts#L738-L829).\n\n**1. The linker flag is appended on every run (bug)**\n\n`project.addToOtherLinkerFlags('-sectcreate __DATA __TNSMetadata \"\u003cproject>/metadata-arm64.bin\"')` runs on every `ns embed ios`: embed forces `prepareProject` each time ([`prepare-native-platform-service.ts`](https://github.com/NativeScript/nativescript-cli/blob/e157c9fb8b3ef9d8e79635e6b5520805b3790b04/lib/services/platform/prepare-native-platform-service.ts#L55)), and `addToOtherLinkerFlags` in `nativescript-dev-xcode` pushes without checking for an existing entry. The host's `OTHER_LDFLAGS` gains one more copy per run.\n\n`ld` accepts a repeated `-sectcreate` for the same segment/section and concatenates the files (checked with a two-flag test link: a 17-byte file produced a 34-byte section). So every re-run adds another full copy of the metadata (roughly 9–12 MB each) to the host executable. The app still works, because the runtime reads from the start of the section.\n\n**2. Nothing delivers the metadata file**\n\nThe flag points at `\u003chostProject>/\u003cprojectName>/metadata-arm64.bin`, but nothing creates that file. The \"Copy Metadata (DEBUG)\" build phase is commented out and step 2 (\"Ensure metadata is copied as a file\") is a `// TODO`. `ns embed` is a prepare, so the metadata generator never runs. Users have to build the NativeScript project separately and copy the file by hand (as the `ns-embed-example` README describes), and the host fails to link if it is missing.\n\n**3. The architecture and SDK are hardcoded**\n\nThe flag always names `metadata-arm64.bin`, and the documented manual step copies the simulator build's file, so device builds link metadata generated against the simulator SDK. The app template uses `metadata-$(CURRENT_ARCH).bin` from the configuration build dir.\n\n**4. Failures in this block are silent**\n\nThe whole host-project setup is wrapped in a `try/catch` that only logs at trace level (\"Error adding NativeScript group to host project\"), so a failure leaves the host partially configured with no visible error.\n\n### Describe the solution you'd like\n\n- [ ] Make adding the `-sectcreate` flag idempotent (skip or replace an existing entry), and clean up duplicates left by earlier runs.\n- [ ] Have `ns embed ios` put the metadata in place, e.g. a build phase in the host that copies it from the NativeScript project's build output (what the commented-out phase sketched).\n- [ ] Reference the metadata per architecture and SDK instead of a fixed `metadata-arm64.bin`.\n- [ ] Surface errors from the host-project setup instead of logging them at trace level.\n\n### Describe alternatives you've considered\n\nFor the metadata file: instead of copying the NativeScript project's metadata, run the metadata generator against the host project's own build settings (the `nsld.sh` mechanism the app template uses). That would also cover native classes that exist only in the host, which the copied metadata does not describe, but it is a larger change. Copying is a reasonable first step.\n\nHaving the host pass `Config.MetadataPtr` explicitly is no longer needed once NativeScript/ios#488 is in: the runtime finds the host executable's section itself, so Swift hosts need no C shim.\n\n### Anything else?\n\n- Runtime side: NativeScript/ios#488. After it, the `NativeScriptSDK` SwiftPM product additionally embeds a default-metadata framework for zero-config hosts, while the `NativeScript` product stays lean.\n- Related docs change outside this repo: `NativeScript/ns-embed-example` tells hosts to add `NativeScriptSDK`. Hosts set up with `ns embed` link their own metadata and should add the `NativeScript` product instead, otherwise they also carry the unused 8.8 MB default-metadata framework.\n\n### Please accept these terms\n\n- [x] I have searched the [existing issues](https://github.com/NativeScript/nativescript-cli/issues) as well as [StackOverflow](https://stackoverflow.com/questions/tagged/nativescript) and this has not been posted before\n- [x] I agree to follow this project's [Code of Conduct](https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#coc)\n","author":{"url":"https://github.com/edusperoni","@type":"Person","name":"edusperoni"},"datePublished":"2026-10-05T17:58:37Z","url":"https://github.com/NativeScript/nativescript-cli/issues/6168"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:5df624d5-1181-2b9f-40d8-8083fb0831fd
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD390:358871:1684AEC:1DA70D4:6B012F00
html-safe-nonce4776c79b9870470476ee464ded9efb321e768107b15c20057a7e632cc99aab0c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzkwOjM1ODg3MToxNjg0QUVDOjFEQTcwRDQ6NkIwMTJGMDAiLCJ2aXNpdG9yX2lkIjoiNTcxMDQ4OTc4NTg0ODYzOTIzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac4d4733a79829be40a445923614afbed0693c0d934d6aeb5c674eb4131f660f78
hovercard-subject-tagissue:5716712726
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/nativescript-cli/6168/issue_layout
twitter:imagehttps://opengraph.githubassets.com/885dcb76229efa4c7c2afbedc0f81bfd327573dc4de92dc07568c82ac6b5b5aa/NativeScript/nativescript-cli/issues/6168
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/885dcb76229efa4c7c2afbedc0f81bfd327573dc4de92dc07568c82ac6b5b5aa/NativeScript/nativescript-cli/issues/6168
og:image:altIs your feature request related to a problem? Please describe. ns embed ios (added in #5803) leaves the host project's metadata setup half-finished. This issue tracks the follow-ups. Context: Nativ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameedusperoni
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/NativeScript/nativescript-cli git https://github.com/NativeScript/nativescript-cli.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id21347346
octolytics-dimension-repository_nwoNativeScript/nativescript-cli
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id21347346
octolytics-dimension-repository_network_root_nwoNativeScript/nativescript-cli
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/NativeScript/nativescript-cli/issues/6168#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fnativescript-cli%2Fissues%2F6168
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fnativescript-cli%2Fissues%2F6168
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=NativeScript%2Fnativescript-cli
Reloadhttps://github.com/NativeScript/nativescript-cli/issues/6168
Reloadhttps://github.com/NativeScript/nativescript-cli/issues/6168
Reloadhttps://github.com/NativeScript/nativescript-cli/issues/6168
NativeScripthttps://github.com/NativeScript
nativescript-clihttps://github.com/NativeScript/nativescript-cli
Codehttps://github.com/NativeScript/nativescript-cli
Issues357 (357)https://github.com/NativeScript/nativescript-cli/issues
Pull requests37 (37)https://github.com/NativeScript/nativescript-cli/pulls
Actionshttps://github.com/NativeScript/nativescript-cli/actions
Projectshttps://github.com/NativeScript/nativescript-cli/projects
Security and qualityhttps://github.com/NativeScript/nativescript-cli/security
Insightshttps://github.com/NativeScript/nativescript-cli/insights
https://github.com/NativeScript/nativescript-cli
New issuehttps://github.com/login?return_to=https://github.com/NativeScript/nativescript-cli/issues/6168
New issuehttps://github.com/login?return_to=https://github.com/NativeScript/nativescript-cli/issues/6168
ns embed ios: finish the host metadata setup (duplicate -sectcreate flags, missing metadata file, hardcoded arch)https://github.com/NativeScript/nativescript-cli/issues/6168#top
feature-pending-triageA new feature request pending triage to confirm validity.https://github.com/NativeScript/nativescript-cli/issues?q=state%3Aopen%20label%3A%22feature-pending-triage%22
https://github.com/edusperoni
edusperonihttps://github.com/edusperoni
on Oct 5, 2026https://github.com/NativeScript/nativescript-cli/issues/6168#issue-5716712726
#5803https://github.com/NativeScript/nativescript-cli/pull/5803
NativeScript/ios#488https://github.com/NativeScript/ios/pull/488
lib/services/ios-project-service.tshttps://github.com/NativeScript/nativescript-cli/blob/e157c9fb8b3ef9d8e79635e6b5520805b3790b04/lib/services/ios-project-service.ts#L738-L829
prepare-native-platform-service.tshttps://github.com/NativeScript/nativescript-cli/blob/e157c9fb8b3ef9d8e79635e6b5520805b3790b04/lib/services/platform/prepare-native-platform-service.ts#L55
NativeScript/ios#488https://github.com/NativeScript/ios/pull/488
perf(ios): ship default metadata as a separate framework for embedding hosts only ios#488https://github.com/NativeScript/ios/pull/488
existing issueshttps://github.com/NativeScript/nativescript-cli/issues
StackOverflowhttps://stackoverflow.com/questions/tagged/nativescript
Code of Conducthttps://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#coc
edusperonihttps://github.com/edusperoni
feature-pending-triageA new feature request pending triage to confirm validity.https://github.com/NativeScript/nativescript-cli/issues?q=state%3Aopen%20label%3A%22feature-pending-triage%22
on Oct 5, 2026https://github.com/NativeScript/nativescript-cli/issues/6168#event-32533341043
Sign up for freehttps://github.com/signup?return_to=https://github.com/NativeScript/nativescript-cli/issues/6168
Sign in to commenthttps://github.com/login?return_to=https://github.com/NativeScript/nativescript-cli/issues/6168
feature-pending-triageA new feature request pending triage to confirm validity.https://github.com/NativeScript/nativescript-cli/issues?q=state%3Aopen%20label%3A%22feature-pending-triage%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.