NativeScript / nativescript-cli

Command-line interface for building NativeScript apps
https://www.npmjs.com/package/nativescript
Apache License 2.0
1.04k stars 195 forks source link

iOS Building Problem (exit code 65) #2858

Closed jibon57 closed 7 years ago

jibon57 commented 7 years ago

Did you verify this is a real problem by searching Stack Overflow and the other open issues in this repo?

Yes, but no luck

Tell us about the problem

Please, ensure your title is less than 63 characters long and starts with a capital letter.

Which platform(s) does your issue occur on?

iOS

Please provide the following version numbers that your issue occurs with:

Please tell us how to recreate the issue in as much detail as possible.

When I am trying to run this line: tns run ios --emulator or tns run ios --emulator --watch

Error:

`CompileStoryboard NativeScript/Resources/LaunchScreen.storyboard
    cd "/Users/jibon/Documents/My Work/NativeScript/platforms/ios"
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    export XCODE_DEVELOPER_USR_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin/..
    /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --errors --warnings --notices --module NativeScript --output-partial-info-plist /Users/jibon/Library/Developer/Xcode/DerivedData/NativeScript-adfgotrkdkddichbuvtsttyxvsek/Build/Intermediates/NativeScript.build/Debug-iphonesimulator/NativeScript.build/LaunchScreen-SBPartialInfo.plist --auto-activate-custom-fonts --target-device iphone --target-device ipad --minimum-deployment-target 8.0 --output-format human-readable-text --compilation-directory /Users/jibon/Library/Developer/Xcode/DerivedData/NativeScript-adfgotrkdkddichbuvtsttyxvsek/Build/Intermediates/NativeScript.build/Debug-iphonesimulator/NativeScript.build /Users/jibon/Documents/My\ Work/NativeScript/platforms/ios/NativeScript/Resources/LaunchScreen.storyboard

** BUILD FAILED **

The following build commands failed:
    CompileAssetCatalog build/emulator/NativeScript.app NativeScript/Resources/Assets.xcassets
(1 failure)
Multiple errors were thrown:
Command xcodebuild failed with exit code 65
# run ios

Any suggestion in where I am doing wrong? Thanks in advance.

NickIliev commented 7 years ago

@jibon57 using your exact package.json configuration I was able to build successfully this project. Try to reset the project with deleting platforms and hooks folder and rebuilding. Also make sure that all of the used plugins are migrated for compatibility with NativeScript 3.x.x. You can also log more datails with executing

tns run ios --log trace

You might alos wnat to check this issue

jibon57 commented 7 years ago

@NickIliev Thanks for reply. I just tried as you have described but still no luck. I had deleted platforms & hooks folder.

CompileStoryboard NativeScript/Resources/LaunchScreen.storyboard
    cd "/Users/jibon/Documents/My Work/NativeScript/platforms/ios"
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    export XCODE_DEVELOPER_USR_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin/..
    /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --errors --warnings --notices --module NativeScript --output-partial-info-plist /Users/jibon/Library/Developer/Xcode/DerivedData/NativeScript-adfgotrkdkddichbuvtsttyxvsek/Build/Intermediates/NativeScript.build/Debug-iphonesimulator/NativeScript.build/LaunchScreen-SBPartialInfo.plist --auto-activate-custom-fonts --target-device iphone --target-device ipad --minimum-deployment-target 8.0 --output-format human-readable-text --compilation-directory /Users/jibon/Library/Developer/Xcode/DerivedData/NativeScript-adfgotrkdkddichbuvtsttyxvsek/Build/Intermediates/NativeScript.build/Debug-iphonesimulator/NativeScript.build /Users/jibon/Documents/My\ Work/NativeScript/platforms/ios/NativeScript/Resources/LaunchScreen.storyboard

** BUILD FAILED **

The following build commands failed:
    CompileAssetCatalog build/emulator/NativeScript.app NativeScript/Resources/Assets.xcassets
(1 failure)
Error: Multiple errors were thrown:
Command xcodebuild failed with exit code 65
    at DevicesService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js:267:23)
    at throw (native)
    at rejected (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js:11:65)
    at process._tickCallback (internal/process/next_tick.js:109:7)
Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'CLI' with value 'help'.
List of registered commands: /?, appstore, appstore|upload, autocomplete, autocomplete|disable, autocomplete|enable, autocomplete|status, build, build|android, build|ios, clean-app, clean-app|android, clean-app|ios, create, debug, debug|android, debug|ios, deploy, dev-generate-help, dev-generate-messages, dev-post-install, dev-preuninstall, dev-test, dev-test|android, dev-test|ios, device, devices, devices|android, devices|ios, device|android, device|get-file, device|ios, device|list-applications, device|list-files, device|log, device|put-file, device|run, device|stop, device|uninstall, doctor, emulate, emulate|android, emulate|ios, error-reporting, extension, extension|install, extension|uninstall, help, info, init, install, platform, platform|add, platform|clean, platform|remove, platform|update, plugin, plugin|add, plugin|install, plugin|remove, plugin|update, post-install-cli, prepare, proxy, proxy|clear, proxy|set, publish, publish|ios, run, run|android, run|ios, test, test|android, test|init, test|ios, update, usage-reporting
Reading help for command 'run|ios'. FileName is 'run-ios.md'.
# run ios

Note: I have copied "app" directory from a windows mechine. In windows it was working fine with Android. But I moved to mac device to build for iPhone.

NickIliev commented 7 years ago

@jibon57 Do you have some resources on which your app is depending located in _AppResources folder (e.g. like images with src of type "res://myImage"). If you are using custom resources for Android located in App_Resources/Android then you will need to provide these resources for iOS as well and locate them in App_Resources/iOS.

jibon57 commented 7 years ago

@NickIliev Thanks again for quick response. Yes, I am using one image "ic_menu.png". I have added screen short of my IOS directory here:

https://prnt.sc/fdpd9a https://prnt.sc/fdpddl

My Code: <NavigationButton text="Menu" icon="res://ic_menu_black" ios.position="left" (tap)="openDrawer()"></NavigationButton>

Please have a look, if I am doing something wrong here.

NickIliev commented 7 years ago

@jibon57 the AssetCatalog and imageset has different way of usage in the native iOS apps. In the default templates, we are using AssetCatalog with different scaled photos to create the splash screen. However in your case when you want to reference a photo with res://myImageName for iOS they should be stored in _AppResources/iOS and not in a subfolder. So directly place the images (with all the different scale naming) in the folder _AppResources/iOS. For reference see how these images are placed in our sample application nativescript-marketplace-demo

In two words - make sure ic_menu.png (and all other iOS resource images) is placed directly in _AppResources/iOS

jibon57 commented 7 years ago

@NickIliev Thank you very much. I found the problem. It was related with icons. But now I am getting this error:

Jibons-Pro:NativeScript jibon$ tns run ios --emulator
Executing before-prepare hook from /Users/jibon/Documents/My Work/NativeScript/hooks/before-prepare/nativescript-dev-android-snapshot.js
Executing before-prepare hook from /Users/jibon/Documents/My Work/NativeScript/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.2.2
Preparing project...
Project successfully prepared (ios)
Executing after-prepare hook from /Users/jibon/Documents/My Work/NativeScript/hooks/after-prepare/nativescript-dev-android-snapshot.js
Searching for devices...
Skipping package build. No changes detected on the native side. This will be fast!
Installing...
Successfully installed on device with identifier '7B9429DE-EEE8-4204-9026-02EDBE2F28BF'.
Executing before-livesync hook from /Users/jibon/Documents/My Work/NativeScript/hooks/before-livesync/nativescript-angular-sync.js
Transferring project files...
Multiple errors were thrown:
cp: cannot create directory 'app': No such file or directory
# run ios
NickIliev commented 7 years ago
cp: cannot create directory 'app': No such file or directory

Is consistent with the fact that you have tried to migrate your project from Windows to Mac using copy/paste. One possible reason is that you have pasted your project in a folder for which you do not have root permissions to execute commands like cp

I can't tell fo sure what is causing your copy command to fail but the best case would be to use source control when working with different OS.

The easiest scenario would be to init a GitHub repository - push the code online and then clone the repository on your Mac. e.g. Create new repository in your GitHub and then from the project folder execute

git init
git commit -m "first commit"
git remote add origin git@github.com:Username/repositoryName.git
git push -u origin master

and then from your Mac

git clone git@github.com:Username/repositoryName.git
cd repositoryName
tns run ios
jibon57 commented 7 years ago

@NickIliev Thank you. I just chmod the directory & it's working... But it isn't installing in my simulator. It's stuck here:

Hooks directories: [ '/usr/local/lib/node_modules/nativescript/lib/hooks',
  '/usr/local/lib/node_modules/nativescript/lib/common/hooks',
  '/Users/jibon/Documents/My Work/NativeScript/hooks' ]
AfterHookName for command prepare is after-prepare
Executing after-prepare hook from /Users/jibon/Documents/My Work/NativeScript/hooks/after-prepare/nativescript-dev-android-snapshot.js
Executing after-prepare hook at location /Users/jibon/Documents/My Work/NativeScript/hooks/after-prepare/nativescript-dev-android-snapshot.js in-process
Validating after-prepare arguments.
Hook completed
Searching for devices...
startLookingForDevices; platform is ios
Starting to look for iOS devices.
Exec ps cax | grep launchd_sim 
 stdout:  2740   ??  S      0:01.87 launchd_sim

 stderr: 
Found device with identifier '623666B3-09F9-4F47-AF53-FCC7ED38924F'
startLookingForDevices; platform is iOS
Exec ps cax | grep launchd_sim 
 stdout:  2740   ??  S      0:01.87 launchd_sim

 stderr: 
Skipping package build. No changes detected on the native side. This will be fast!
Installing...

& nothing happening... Click on Control + C

Transferring project files...
Transferring from /Users/jibon/Documents/My Work/NativeScript/platforms/ios/NativeScript/app to app
Successfully transferred all files.
Refreshing application...
^C^CError: Multiple errors were thrown:
Cannot read property 'trim' of undefined
    at DevicesService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js:267:23)
    at throw (native)
    at rejected (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js:11:65)
Analytics statuses: 
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'CLI' with value 'help'.
List of registered commands: /?, appstore, appstore|upload, autocomplete, autocomplete|disable, autocomplete|enable, autocomplete|status, build, build|android, build|ios, clean-app, clean-app|android, clean-app|ios, create, debug, debug|android, debug|ios, deploy, dev-generate-help, dev-generate-messages, dev-post-install, dev-preuninstall, dev-test, dev-test|android, dev-test|ios, device, devices, devices|android, devices|ios, device|android, device|get-file, device|ios, device|list-applications, device|list-files, device|log, device|put-file, device|run, device|stop, device|uninstall, doctor, emulate, emulate|android, emulate|ios, error-reporting, extension, extension|install, extension|uninstall, help, info, init, install, platform, platform|add, platform|clean, platform|remove, platform|update, plugin, plugin|add, plugin|install, plugin|remove, plugin|update, post-install-cli, prepare, proxy, proxy|clear, proxy|set, publish, publish|ios, run, run|android, run|ios, test, test|android, test|init, test|ios, update, usage-reporting
Reading help for command 'run|ios'. FileName is 'run-ios.md'.
NickIliev commented 7 years ago

@jibon57 try installing the app explicitly on the started device with the following workflow

Start your iOS simulator manually and then execute

tns device

Your simulator should be listed in a similar table

│ # │ Device Name          │ Platform │ Device Identifier │ Type     │ Status    │
│ 1 │ bullhead             │ Android  │ 00d3e1311075c66f  │ Device   │ Connected │
│ 2 │ sdk_google_phone_x86 │ Android  │ emulator-5554     │ Emulator │ Connected │

Then uninstall any previously installed version of your app from the simulator and run

tns run ios --device deviceId

where deviceId is the id of your iOS simulator.

jibon57 commented 7 years ago

@NickIliev , Still no luck... I stuck ...

https://prnt.sc/fdtr5s

I had reset all settings & contents of that simulator.

I am on MacOS: 10.12.5 (16F73) Xcode: Version 8.3.2 (8E2002)

NickIliev commented 7 years ago

@jibon57 have you changed your packageId during the development? After Successfully transferred all files swipe left/right your simulator and look for the application - it is possible that it is deployed but not started if you have changed your packageId incorrectly.

Also, you can try to create a basic project and run it on the simulator just to eliminate the possibilities that you have environment issues.

tns create testApp
tns run ios 

In order to help you further please create a detail;ed log with executing

tns run ios --log trace

or directly write the log to file and then send it to us

tns run ios --log trace > log.txt
sitefinitysteve commented 7 years ago

Anyone maybe have LSLint installed into VSCode? That solved it for me (I think, knock on wood)

shinriyo commented 6 years ago

Thank you. I got same error. And I could get more detailed log via tns run ios --log trace. the log is there.

Python version: 2.7.10 (default, Jul 15 2017, 17:16:57)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]
Generating metadata for i386
Error: Unable to generate metadata for i386.
dyld: Library not loaded: @rpath/libc++.1.dylib
  Referenced from: /Users/shinriyo/tns_apps/HelloWorld/platforms/ios/internal/metadata-generator/bin/./objc-metadata-generator
  Reason: image not found
sagar1911 commented 6 years ago

I came across with this problem. I removed the nativescript@3.2.0 and installed nativescript@3.1.2, problem solved.

99hats commented 6 years ago

tns update

Worked for me, YMMV.

snq commented 5 years ago

tns build ios --clean solved the issue for me

phenric commented 5 years ago

In my case, I suspect the issue exists because I changed the app icons with tns resources generate icons path and I do not have an Apple Developper licence.

Can someone confirm ?

phenric commented 5 years ago

As expected, it works for me when I reseted the default icons.

czachandrew commented 5 years ago

I know this is really old but is there a simple method to reseting the default icons?

alexandre-combemorel commented 4 years ago

As expected, it works for me when I reseted the default icons.

If someone pass by, yes that was my issue as well, it fixed the problem. I simply copy past the App_Ressources/iOS folder from a app created with tns create then it worked

adideas commented 2 years ago

HI !

Here is what helped me

STEP 1 (build.xcconfig)

// xcode 13
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS=$(inherited)
$(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))

IPHONEOS_DEPLOYMENT_TARGET = 12.0

STEP 2 (Podfile)

pod 'CocoaAsyncSocket'

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
      config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] ='NO'
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
    end
  end
end

IPHONEOS_DEPLOYMENT_TARGET = 12.0

give me a star thanks