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

{N} 7.0.1 adds the wrong iOS 14 frameworks to project #8937

Closed
eltharynd opened this issue Oct 5, 2020 · 36 comments
Closed

{N} 7.0.1 adds the wrong iOS 14 frameworks to project #8937

eltharynd opened this issue Oct 5, 2020 · 36 comments
Assignees

Comments

@eltharynd
Copy link

@eltharynd eltharynd commented Oct 5, 2020

Environment

  • CLI: 7.0.1
  • iOS Runtime: @nativescript/ios 7.0.1

Describe the bug
NativeScript.framework/NativeScript and TKLiveSync.framework/TKLiveSync are compiled with sdk 14.2 so it works on simulators/devices/testflight but if you try to submit for review to the app store it says

ITMS-90512: Invalid sdk value - The value provided for the sdk portion of LC_VERSION_MIN_IPHONEOS in mypackagename.app/Frameworks/NativeScript.framework/NativeScript is 14.2 which is greater than the maximum allowed value of 14.0.

ITMS-90512: Invalid sdk value - The value provided for the sdk portion of LC_VERSION_MIN_IPHONEOS in mypackagename.app/Frameworks/TKLiveSync.framework/TKLiveSync is 14.2 which is greater than the maximum allowed value of 14.0.

To Reproduce
Just submit for review an app to the app store

Expected behavior
The two frameworks should be built with release sdk not beta

Also here
Originally posted by @eltharynd in #8867 (comment)

@eltharynd
Copy link
Author

@eltharynd eltharynd commented Oct 6, 2020

I was able to find a temporary workaround...
I build my own frameworks...

Here's a simplified step by step

# Clone repo
git clone https://github.com/NativeScript/ns-v8ios-runtime.git

# Install CMake and LLVM (8)
brew install cmake llvm@8

# Open the runtime in XCode
cd ns-v8ios-runtime
open v8ios.xcodeproj

# Update the project to use the 12.0 sdk instead u
Click the yellow xcode warning on the left that asks to update the sdk version and confirm

#If you have an error i just modified it this way cause it wasn't taking it as a single expression
const std::__1::string buffer = std::to_string(i);
const char* name = buffer.c_str();

# Build the device version of frameworks
Select the Nativescript target and any ios device and hit Run (the play button).
Select the TKLiveSync target and any ios device and hit Run (the play button).

#On your project clean the platform and prepare it
tns clean
tns prepare ios --for-device

#Open your workspace with xcode

#on the project general tab remove both frameworks
#Nativescript 
#TKLiveSync 

#Drag v8ios.xcodeproj from its xcode window to your app name on your app xcode window
#this will make your project use your 12.0 compiled frameworks

#Select any ios device, build and then ytou can archive and deploy from xcode and it should work

basically a combination of both
https://github.com/NativeScript/ns-v8ios-runtime
and
https://docs.nativescript.org/core-concepts/ios-runtime/how-to/debug-ios-runtime

as a side note: I'm not still 100% sure it worked but usually after 3 minutes from submitting for review I immediately got the error, it hasn't so far for about an hour... by usual apple standards i can only be sure about this in 2 days but So far it seems ok.. I'll update if this doesn't work

@michael-dots
Copy link

@michael-dots michael-dots commented Oct 6, 2020

When can we expect a fix? Just encountered this as well!

@eltharynd
Copy link
Author

@eltharynd eltharynd commented Oct 6, 2020

It would be sufficient to rebuild the project and publish as a new version I'm pretty sure so it shouldn't take long

@rigor789
Copy link
Member

@rigor789 rigor789 commented Oct 6, 2020

@eltharynd thanks for looking into this - will be publishing a fixed version tomorrow!

@rigor789
Copy link
Member

@rigor789 rigor789 commented Oct 7, 2020

Published @nativescript/ios@7.0.2-rc.0 rebuilt with xcode12 (was originally built with 12 beta I believe?) and that should solve the issue - however keeping it rc just to confirm before releasing it.

If able, pull in new version, rebuild/submit the app.

Update: Also make sure you are building with a stable release of xcode!

@michael-dots
Copy link

@michael-dots michael-dots commented Oct 7, 2020

Tried installing package, and publishing, but same error, will try to clean.

Edit:

Nope same problem:

Dear Developer, We identified one or more issues with a recent submission for App Store review for your app, "***".

Please correct the following issues, then upload again.

ITMS-90512: Invalid sdk value - The value provided for the sdk portion of LC_VERSION_MIN_IPHONEOS in JKG2.app/Frameworks/NativeScript.framework/NativeScript is 14.2 which is greater than the maximum allowed value of 14.0.
ITMS-90512: Invalid sdk value - The value provided for the sdk portion of LC_VERSION_MIN_IPHONEOS in JKG2.app/Frameworks/TKLiveSync.framework/TKLiveSync is 14.2 which is greater than the maximum allowed value of 14.0.

Best regards, The App Store Team

@eltharynd
Copy link
Author

@eltharynd eltharynd commented Oct 8, 2020

as a side note: I'm not still 100% sure it worked but usually after 3 minutes from submitting for review I immediately got the error, it hasn't so far for about an hour... by usual apple standards i can only be sure about this in 2 days but So far it seems ok.. I'll update if this doesn't work

Day two.. apple is still looking at the clouds...
At least I've had no errors so far

Update: app is in review at this very moment..

@eltharynd
Copy link
Author

@eltharynd eltharynd commented Oct 8, 2020

We were still unable to review your app as it crashed on launch. We have attached detailed crash logs to help troubleshoot this issue.

...... it didn't crash on emulator, it didn't crash on phisical devices... a user has been using it daily with no crashes............

I.
fing.
hate.
apple.

@eltharynd
Copy link
Author

@eltharynd eltharynd commented Oct 8, 2020

Ok here's what makes it crash...

Termination Description: DYLD, dyld: Using shared cache: 576E48BE-CF7D-3813-BCF6-3D1EFD8C96D3 | dependent dylib '@rpath/NativeScript.framework/NativeScript' not found for '/private/var/containers/Bundle/Application/FC200111-B7B6-4B21-B86D-22685C00BEB7/chdivooraappdriver.app/chdivooraappdriver', tried but didn't find: '/private/var/containers/Bundle/Application/FC200111-B7B6-4B21-B86D-22685C00BEB7/chdivooraappdriver.app/Frameworks/NativeScript.framework/NativeScript' '@rpath/NativeScript.framework/NativeScript' '/System/Library/Frameworks/NativeScript.framework/NativeScript'

@rpath/NativeScript.framework/NativeScript' not found

Which i don't understand how is that even possible but I'm gonna run some tests on real devices right now and I'll take a chance to test the @nativescript/ios@7.0.2-rc.0 as well @rigor789 ..
If you wanna move this conversation somewhere else let me know

Frankly my best (but completely random) guess is Apple is testing for their whole "let's make native mobile apps work on desktop machines" thing.. which i do not want/care for and personally my thoughts on the whole matter are "frick you, Apple!"

@eltharynd
Copy link
Author

@eltharynd eltharynd commented Oct 8, 2020

Forget What i just edited out...

I've noticed the app crashes when i close it...

Uncaught Error: View not added to this instance. View: Frame(2) CurrentParent: undefined ExpectedParent: AppHostView(1)

Here's the log from the exception in debugging

***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error: Uncaught Error: View not added to this instance. View: Frame(2) CurrentParent: undefined ExpectedParent: AppHostView(1)
at
ZoneAwareError(file: node_modules/@nativescript/zone-js/zone-nativescript.js:1298:0)
at _removeView(file: node_modules/@nativescript/core/ui/core/view-base/index.js:456:0)
at removeFromVisualTree(file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:2516:0)
at removeChild(file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:2444:0)
at ngOnDestroy(file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:3033:0)
at (file: node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11077:0)
at destroy(file: node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11077:0)
at destroy(file: node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:24248:0)
at (file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:727:0)
at _handleEvent(file: node_modules/@nativescript/core/data/observable/index.js:231:0)
at notify(file: node_modules/@nativescript/core/data/observable/index.js:214:0)
at willTerminate(file: node_modules/@nativescript/core/application/index.ios.js:192:0)
at push.../node_modules/@nativescript/core/application/index.js.NotificationObserver.onReceive(file: node_modules/@nativescript/core/application/index.ios.js:39:0)
*** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught Error: View not added to this instance. View: Frame(2) CurrentParent: undefined ExpectedParent: AppHostView(1)
at
ZoneAwareError(file: node_modules/@nativescript/zone-js/zone-nativescript.js:1298:0)
at _removeView(file: node_modules/@nativescript/core/ui/core/view-base/index.js:456:0)
at removeFromVisualTree(file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:2516:0)
at removeChild(file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:2444:0)
at ngOnDestroy(file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:3033:0)
at (file: node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11077:0)
at destroy(file: node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11077:0)
at destroy(file: node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:24248:0)
at (file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:727:0)
at _handleEvent(file: node_modules/@nativescript/core/data/observable/index.js:231:0)
at notify(file: node_modules/@nativescript/core/data/observable/index.js:214:0)
at willTerminate(file: node_modules/@nativescript/core/application/index.ios.js:192:0)
at push.../node_modules/@nativescript/core/application/index.js.NotificationObserver.onReceive(file: node_modules/@nativescript/core/application/index.ios.js:39:0)
', reason: '(null)'

Ok I KNOW this isn't exactly a good approach.. but.. at this point it's more important that our app works cause it's an internal app and many employees have been stuck for a while...
So after running
ns prepare ios --for-device

i commented this line

if (view.parent !== this) {
    //throw new Error('View not added to this instance. View: ' + view + ' CurrentParent: ' + view.parent + ' ExpectedParent: ' + this);
}

in
node_modules/@nativescript/core/ui/core/view-base/index.js
line 456...
I think this will allow it to get published.. obviously that could lead to problems but at least we know what's wrong and where

-I just submitted for review... it passed the usual couple mins for the 14.2 sdk error... I'll keep you posted about the publishing
-update: no it didn't pass the 14.3 sdk test... it just took a bit longer than usual

@BlueHunter99
Copy link

@BlueHunter99 BlueHunter99 commented Oct 8, 2020

@rigor789 getting the same issue as @michael-dots even while using @nativescript/ios@7.0.2-rc.0

@rigor789
Copy link
Member

@rigor789 rigor789 commented Oct 8, 2020

@BlueHunter99 @michael-dots I wonder if this is coming from a podfile, because there's no mentions of 14.2 in the rc build anywhere... Perhaps try adding the following to App_Resources/iOS/Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
     config.build_settings.delete 'LC_VERSION_MIN_IPHONEOS'
    end
  end
end
@stephaneQ2
Copy link

@stephaneQ2 stephaneQ2 commented Oct 8, 2020

Hi @rigor789 ,
I just submitted with your recommended fix. I will let you know if it works.
Thanks!!!

@jeremypele
Copy link

@jeremypele jeremypele commented Oct 8, 2020

@rigor789 Just tested the Podfile solution and it doesn't work 😢

ITMS-90512: Invalid sdk value - The value provided for the sdk portion of LC_VERSION_MIN_IPHONEOS
 in booking.app/Frameworks/NativeScript.framework/NativeScript is 14.2 
 which is greater than the maximum allowed value of 14.0.

ITMS-90512: Invalid sdk value - The value provided for the sdk portion of LC_VERSION_MIN_IPHONEOS 
in booking.app/Frameworks/TKLiveSync.framework/TKLiveSync is 14.2 
which is greater than the maximum allowed value of 14.0.
@rigor789
Copy link
Member

@rigor789 rigor789 commented Oct 8, 2020

@jeremypele and that's using @nativescript/ios@7.0.2-rc.0?

@ethnovode
Copy link

@ethnovode ethnovode commented Oct 8, 2020

I tried with @nativescript/ios@7.0.2-rc.0 and the Podfile but my app crash on launch when downloaded from TestFlight. It works very well on the physical device (or simulator) directly with the ns debug command.

@rigor789
Copy link
Member

@rigor789 rigor789 commented Oct 8, 2020

@ethnovode any logs you can get from the device? (submit the crash to TestFlight and get it from there perhaps?)

@jeremypele
Copy link

@jeremypele jeremypele commented Oct 8, 2020

Yes using the rc version. Got the same error coming from Apple
Works well on testflight though on my end

@michael-dots
Copy link

@michael-dots michael-dots commented Oct 9, 2020

Not sure if this is relevant but

platforms/ios/build/Release-iphoneos/NativeScript.framework/Info.plist
platforms/ios/build/Release-iphoneos/TKLiveSync.framework/Info.plist

.. and some other files contain a DTPlatformVersion = 14.2

Edit: these files origin from node_modules/@nativescript/ios/framework/internal/XCFrameworks.zip

@eltharynd
Copy link
Author

@eltharynd eltharynd commented Oct 9, 2020

HERE'S THE ULTIMATE GUIDE ON HOW TO SUCCESSFULLY BUILD FOR PUBLISHING

tldr: We're gonna build and archive our own Nativescript.xcframework and TKLiveSync.xcframework, and embed & sign them in our app..

Clone the runtime repo somewhere
git clone https://github.com/NativeScript/ns-v8ios-runtime.git

Install Cmake and LLVM (not really sure if needed but you never know)
brew install cmake llvm@8

Open the runtime in xcode

cd ns-v8ios-runtime
open v8ios.xcodeproj

Update the project to use the 12.0 sdk instead
Click the yellow xcode warning on the left that asks to update the sdk version and confirm

You will get an error, click on it to get to the file and modify it this way

auto buffer = std::to_string(i);
const char* name = buffer.c_str();

In the runtime folder run the following commands

xcodebuild archive -workspace v8ios.xcworkspace -scheme NativeScript -sdk iphoneos14.0 OBJROOT=build/iOS
xcodebuild -create-xcframework -framework build/iOS/UninstalledProducts/iphoneos/NativeScript.framework -output build/NativeScript.xcframework

xcodebuild archive -workspace v8ios.xcworkspace -scheme TKLiveSync -sdk iphoneos14.0 OBJROOT=build/iOS
xcodebuild -create-xcframework -framework build/iOS/UninstalledProducts/iphoneos/TKLiveSync.framework -output build/TKLiveSync.xcframework

This will build and archive the two Schemes in the .xcframework format

On your project clean everything to be sure there's no other earlier attemps laying around
ns clean
Install node packages
npm install

Open node_modules/@nativescript/core/ui/core/view-base/index.js and comment out line 456

if (view.parent !== this) {
    //throw new Error('View not added to this instance. View: ' + view + ' CurrentParent: ' + view.parent + ' ExpectedParent: ' + this);
}

This will avoid your app crashing when closing and therefore allow it to pass app store review (altho obv this will have to be fixed)

Prepare the xcode project
ns prepare ios --for-device

Open it in xcode, then click on your project name, in the General tab click on your app target and look for Frameworks, Libraries, and Embedded Content
There you will find Nativescript.xcframework and TKLiveSync.xcframework.
Click on them and hit the minus sign to remove them both.

Click on the plus sign, hit "Add Other..." > "Add Files..." and navigate to the ns-v8ios-runtime/build folder
Select Nativescript.xcframework and add it to the project.
Do the same for TKLiveSync.xcframework

Make sure both are on "Embed & Sign"

At this point you can Build, Archive and Deploy normally.

notes:
I'm pretty sure this solution will work. But as usual, it will take about 2 days for apple to review it and confirm...
I'll keep you posted...

TODO:
@nativescript/core should be updated to fix the exception
@nativescript/ios should be fixed to build with release sdk instead of 14.2

UPDATE 2020-10-09 10:14 UTC:
I don't know what's happening to apple but somehow the app is already in review a mere hour after submitting this... I'll let you know pretty soon the results

UPDATE 2020-10-09 11:41 UTC:
App was accepted... (Tbh it was rejected cause they didn't like something else, but the binary was ok)

@michael-dots
Copy link

@michael-dots michael-dots commented Oct 9, 2020

Hope we can get a -rc fix soon, as I'm not comfortable trying to follow @eltharynd 's workaround.

@ethnovode
Copy link

@ethnovode ethnovode commented Oct 9, 2020

@ethnovode any logs you can get from the device? (submit the crash to TestFlight and get it from there perhaps?)

I wasn't able to get the crashlog from TestFlight but with Xcode -> Window -> Devices -> View Device Logs I saw this line : NativeScript encountered a fatal error: Uncaught TypeError: "@nativescript/firebase".init is not a function.

So I guess it's a problem with Firebase.

@jeremypele
Copy link

@jeremypele jeremypele commented Oct 9, 2020

@ethnovode any logs you can get from the device? (submit the crash to TestFlight and get it from there perhaps?)

I wasn't able to get the crashlog from TestFlight but with Xcode -> Window -> Devices -> View Device Logs I saw this line : NativeScript encountered a fatal error: Uncaught TypeError: "@nativescript/firebase".init is not a function.

So I guess it's a problem with Firebase.

Using the latest version of @nativescript/firebase myself and have not problem with it. Push notifications are properly received

@eltharynd
Copy link
Author

@eltharynd eltharynd commented Oct 9, 2020

I can confirm @nativescript/firebase ^11.0.0 is working fine for me

firebase.init({
    showNotifications: true,
    showNotificationsWhenInForeground: true,
    onPushTokenReceivedCallback: (token) => {
        AppComponent.firebaseToken = token
        FIREBASE_TOKEN.next(token)
    },
    onMessageReceivedCallback: (message) => {
        FIREBASE_SUBJECT.next(message)
    }
}).then(() => {
    console.info('firebase initialized')
}).catch((e) => {
    console.info('firebase init exception', e)
})
@raphykoman
Copy link

@raphykoman raphykoman commented Oct 9, 2020

Hi @eltharynd , thank you for your workaround. We just submitted the app to the app store. let's hope.

@ethnovode
Copy link

@ethnovode ethnovode commented Oct 9, 2020

I didn't properly updated firebase to ns7 with the require still in place instead of the import. That was triggered only on production environnement. So now my app works fine from TestFlight for iOS 14 devices. I still seems to have some troubles with iOS 10 (didn't test other iOS), the app doesn't launch (simulator nor physical).

@rigor789
Copy link
Member

@rigor789 rigor789 commented Oct 9, 2020

@eltharynd I'm worried about using 12.0 as the sdk - as that would result in ios 9.0+ devices not working

@jeremypele
Copy link

@jeremypele jeremypele commented Oct 9, 2020

Where's the @nativescript/ios hosted? Npm links to the ios-runtime directory but doesn't seems to be it

@triniwiz
Copy link
Member

@triniwiz triniwiz commented Oct 9, 2020

The new runtime is here

@NathanaelA
Copy link
Member

@NathanaelA NathanaelA commented Oct 10, 2020

We have pushed a new RC1 -- this should solve the upload to Apple issue. We sincerely apology for the issue; somehow the last RC still got built with a XCode Beta even though the Xcode tooling said it was using the XCode GM 12.01.

npm i --save-dev @nativescript/ios@latest

then a

ns clean

You should be good after this...

@NathanaelA
Copy link
Member

@NathanaelA NathanaelA commented Oct 10, 2020

As for this issue:

if (view.parent !== this) {
//throw new Error('View not added to this instance. View: ' + view + ' CurrentParent: ' + view.parent + ' ExpectedParent: ' + this);
}

Whoever can duplicate that issue; can they please create a new bug report with their package.json. My test app that I just ran didn't have any crashing issues on startup or quiting of the app. So we need some steps to try and duplicate that issue.

@ngocnt1
Copy link

@ngocnt1 ngocnt1 commented Oct 10, 2020

We have pushed a new RC1 -- this should solve the upload to Apple issue. We sincerely apology for the issue; somehow the last RC still got built with a XCode Beta even though the Xcode tooling said it was using the XCode GM 12.01.

npm i --save-dev @nativescript/ios@latest

then a

ns clean

You should be good after this...

It worked for my app's submission. Applestore 's not longer reject it with the ITMS-90512 issue.
My local env:
√ Getting NativeScript components versions information...
√ Component nativescript has 7.0.10 version and is up to date.
√ Component @nativescript/core has 7.0.10 version and is up to date.
√ Component @nativescript/ios has 7.0.2-rc1 version and is up to date.
√ Component @nativescript/android has 7.0.0 version and is up to date.

Xcode 12.0.1
MacOS 10.15.7

@jeremypele
Copy link

@jeremypele jeremypele commented Oct 10, 2020

Same here, built yesterday with the new RC and passed Apple validation today 👍
Thanks guys 🙏

@romandragan
Copy link

@romandragan romandragan commented Oct 14, 2020

We're still experiencing NativeScript/nativescript-cli#5411 with the latest @nativescript/ios@7.0.2-rc.1 and CLI 7.0.10.

@shirakaba
Copy link
Contributor

@shirakaba shirakaba commented Oct 17, 2020

I was facing this issue on @nativescript/ios@7.0.1 (with CLI v7.0.10 and Xcode 12.0.1). I can confirm that @nativescript/ios@7.0.3 fixes it.

@NathanaelA walked me through the steps to update to @nativescript/ios@7.0.3. Simply installing the latest via npm install @nativescript/ios@latest is not sufficient, as it's rather aggressively cached (or something along those lines). You have to do a clean build.

Here's my terminal history for doing a clean build with the latest iOS runtime:

rm -rf platforms/ios
# Removing `node_modules/@nativescript/ios` would be sufficient, but
# I decided I might as well re-install all my node modules while I was at it.
rm -rf node_modules
rm package-lock.json
tns platform add ios@7.0.3
npm install
tns run ios --device "iPhone 11 Pro" --no-hmr
# Check it works as intended on the simulator.

I then opened platforms/ios/NSIDE/NSIDE.xcworkspace as usual, cleaned the build folder, and archived for iOS, and it worked.

Now my app is waiting in review, and hasn't been immediately rejected due to LC_VERSION_MIN_IPHONEOS.

EDIT: My app was accepted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet