Ionic-cli: Ionic Build is stuck with Xcode 8.0

Created on 22 Sep 2016  路  29Comments  路  Source: ionic-team/ionic-cli

_From @chack on September 21, 2016 20:31_

Short description of the problem:

With Xcode 8.0 I can't use ionic build command for iOS. I already removed and readded hooks and iOS platform. The command is stuck after the printed console log below:

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

Build settings from command line:

CONFIGURATION_BUILD_DIR = /Users/Jan/Documents/Wohntraum360/wohntraumapp/platforms/ios/build/emulator

SDKROOT = iphonesimulator10.0
SHARED_PRECOMPS_DIR = /Users/Jan/Documents/Wohntraum360/wohntraumapp/platforms/ios/build/sharedpch

Build settings from configuration file '/Users/Jan/Documents/Wohntraum360/wohntraumapp/platforms/ios/cordova/build-debug.xcconfig':

CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES

CODE_SIGN_IDENTITY = iPhone Developer
ENABLE_BITCODE = NO
GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1

HEADER_SEARCH_PATHS = "$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include" "$(BUILT_PRODUCTS_DIR)"
IPHONEOS_DEPLOYMENT_TARGET = 8.0
OTHER_LDFLAGS = -ObjC
SWIFT_OBJC_BRIDGING_HEADER = $(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h

TARGETED_DEVICE_FAMILY = 1,2

Which Ionic Version? 1.x or 2.x

2.0 Beta 11

Run ionic info from terminal/cmd prompt: (paste output below)

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-beta.11
Ionic CLI Version: 2.0.0
Ionic App Lib Version: 2.0.0-beta.20
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v4.4.7
Xcode version: Xcode 8.0 Build version 8A218a

_Copied from original issue: driftyco/ionic#8161_

old major version

Most helpful comment

Just a heads-up. I started to wonder if my issue was related to iCloud sync, so I turned off Desktop and Document sync in iCloud settings on my Mac. Doing so leaves you with NOTHING in the Desktop or Documents local folder, only your files in the iCloud root. But, after copying things back to where they started (Desktop and Documents content) I was able to build just fine with no modifications listed above. Worth noting that my project root is in ~/Documents/Code so it appears that disabling the sync "fixed" some conflict happening there.

So, if you are on Sierra, have a project in a sync path, and this is occurring you might want to try turning off the iCloud sync OR move your project to another location that is not in the path of the sync. Hope this helps.

All 29 comments

+1

Build settings from configuration file /Users/quick1/Desktop/Apps/mpn/platforms/ios/cordova/build-debug.xcconfig':
    CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
    CODE_SIGN_IDENTITY = iPhone Developer
    ENABLE_BITCODE = NO
    GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1
    HEADER_SEARCH_PATHS = "$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include" "$(BUILT_PRODUCTS_DIR)"
    IPHONEOS_DEPLOYMENT_TARGET = 8.0
    OTHER_LDFLAGS = -ObjC

    SWIFT_OBJC_BRIDGING_HEADER = $(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h
    TARGETED_DEVICE_FAMILY = 1,2


Your system information:

Cordova CLI: 6.3.1
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 1.3.1
Ionic CLI Version: 2.0.0
Ionic App Lib Version: 2.0.0-beta.20
ios-deploy version: 1.9.0 
ios-sim version: 5.0.8 
OS: Mac OS X El Capitan
Node Version: v4.2.2
Xcode version: Xcode 8.0 Build version 8A218a 


Update.

I was able to remove Xcode 8 and revert back to Xcode 7.3 and it seems like everything is running fine.

However, 7.3 doesn't ship with the IOS 10 emulator.

Still running Sierra

@quickly79: Thanks for your response, but I need Xcode 10 for other projects ... Any fix ?

If it helps, this is also happening on the latest and greatest Ionic release:

Cordova CLI: 6.3.1
Gulp version:  CLI version 3.9.1
Gulp local:  
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: Not installed
ios-sim version: 5.0.8 
OS: Mac OS X El Capitan
Node Version: v6.7.0
Xcode version: Xcode 8.0 Build version 8A218a

I have no idea why it's listing El Capitan as my OS X version however 馃槃.

mac os x version

Yes, facing the same problem as well.

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-beta.11
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: 1.8.5
ios-sim version: 5.0.6
OS: Mac OS X El Capitan
Node Version: v6.7.0
Xcode version: Xcode 8.0 Build version 8A218a

Same problem here.

Cordova CLI: 6.3.1
Ionic Framework Version: 1.3.1
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v6.6.0
Xcode version: Xcode 8.0 Build version 8A218a

Please note that ionic info says that I'm using El Captan, but I'm actually using Sierra.

Removing the hooks and platform and re-adding them did the trick for me:

ionic hooks remove
ionic platform remove ios

ionic hooks add
ionic platform ios

@ltalhouarne

This solution worked for me :)

Thanks

Well, the problem now is that every time I need to build a new version of the app, I must use the commands mentioned by @ltalhouarne :(

@fabianoarruda Here's what I'm doing now:

  • Rename XCode.app to Xcode 8.app
  • Download and install XCode 7.3.1
  • Copy Device Support for iOS 10.0 from Xcode 8 installation to Xcode 7.3.1 app. Follow answer in this post: http://stackoverflow.com/questions/37945376/use-xcode-7-with-ios-10
  • When you run ionic build ios on terminal it will now build against XCode 7.3.1
  • When running on actual device or emulator or Archiving to upload to iTunes, use XCode 8.app

It's damn annoying but this is the only way right now until this is fixed. Anyone have better idea, please share.

Just a heads-up. I started to wonder if my issue was related to iCloud sync, so I turned off Desktop and Document sync in iCloud settings on my Mac. Doing so leaves you with NOTHING in the Desktop or Documents local folder, only your files in the iCloud root. But, after copying things back to where they started (Desktop and Documents content) I was able to build just fine with no modifications listed above. Worth noting that my project root is in ~/Documents/Code so it appears that disabling the sync "fixed" some conflict happening there.

So, if you are on Sierra, have a project in a sync path, and this is occurring you might want to try turning off the iCloud sync OR move your project to another location that is not in the path of the sync. Hope this helps.

@TheMattRay you are absolutely right! Coincidentally my project root also resides under ~/Documents/code. I just moved it out as you said, and it is now building, no more hacking required! So, iCloud sync definitively interferes with the building process! Now I wonder why... Im not sure how but this needs to be investigated further and if its a issue related to iCloud we should report it to Apple.

@TheMattRay change the directory worked for me too, thanks

I had this issue in Cordova / Phonegap - Confirming moving it out of iCloud folder fixed issue

Sounds, like a bad joke. Is there any topic in Apple forum or ticket in their ticket system?

I faced with a same problem.
I added build.json in root of project and it helped. I think that the problem with xcodebuild. It can't parse project file without correct signing properties. For manual(default xcode 7 method) signing use only provisioningProfile and codeSignIdentity

@TheMattRay remove iCloud sync for desktop and documents and it works. thank you

@TheMattRay removing my folder from the iCloud Sync domain (e.g. Documents, Desktop ..) solved my problem as well.
Thanks!

I know I am bit late in the party, however, this has stopped working for me again, without any explanation.

My ionic info

Your system information:

Cordova CLI: 7.0.1
Gulp version:  CLI version 1.2.1
Gulp local:  
Ionic Version: 1.2.4-nightly-1917
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
ios-deploy version: 1.9.0 
ios-sim version: 5.0.6 
OS: Mac OS X El Capitan
Node Version: v4.8.3
Xcode version: Xcode 8.1 Build version 8B62 

cordova-ios: 4.4.0

I've the node-xcode : 0.9.3 with following code:

// parsing is slow and blocking right now
// so we do it in a separate process
var fs = require('fs'),
    parser = require('./parser/pbxproj'),
    path = process.argv[2],
    fileContents, obj;

try {
    fileContents = fs.readFileSync(path, 'utf-8');
    obj = parser.parse(fileContents);
    process.send(obj);
} catch (e) {
    process.send(e);
    process.exitCode = 1;
}

Now, when I run

ionic build ios --verbose

it stops mid way after add to body class: platform-ios, on random lines, such as:

In module 'AssetsLibrary' imported from /Users/ravish/Ionic/platforms/ios/CordovaLib/Classes/Public/CDVURLProtocol.m:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk/System/Library/Frameworks/AssetsLibrary.framework/Headers/ALAssetsLibrary.h:95:1: note: 'assetForURL:resultBlock:failureBlock:' has been explicitly marked deprecated here
- (void)assetForURL:(NSURL *)assetURL resultBlock:(ALAssetsLibraryAssetForURLResultBlock)resultBlock failureBlock:(ALAssetsLibraryAccessFailureBlock)failureBlock NS_DEPRECATED_IOS(4_0, 9_0, "Use fetchAssetsWithLocalIdentifiers:options: on PHAsset to fetch assets by local identifier (or to lookup PHAssets by a previously known ALAssetPropertyAssetURL use fetchAssetsWithALAssetURLs:options:) from the Photos framework instead");
^

and sometimes on this line:

platforms/ios/CordovaLib/Classes/Public/CDVURLProtocol.m:60:9:

the stops at random line numbers.

I tried running:

ionic prepare ios
ionic compile ios

Same outcome.

I also removed all my plugins to ensure that none them are causing problem, then did this:

ionic state reset
ionic build ios

Still same result, any suggestion?

PS: Build does not fails, it just stops mid way without any error.

@ravishtiwari: remove icloud sync from your project and also ionic rm platform ios and ionic add platform ios. That should fix the issue.

@emint88 - I cloned to separate location that user home: ~/Projects/IonicProject/

However, still same result. No Error build stopping at different line number each time.

@ravishtiwari : step 1 - remove iCloud sync for desktop and documents
step 2 - remove platform , update node.js as you mention it is slow.
step 3 - add platform

@emint88 - my new clone location is outside Desktop and Document, in user home directory.
I've Node 4.8.3, I earlier had node v6, but, it was creating issues, so downgraded to v4. I will try the steps you mentioned one more time and report back to you.

Well, it not working. cloned under ~/, fresh clone, ran, ionic platform remove ios, ionic platform add ios, ionic build ios.
Did not work, did a ionic state reset, ionic build ios, same result.

Removed the platform/, plugin and node_modules/ directory manually, and repeated the steps, no error, but, no success also.

@emint88 - I am only syncing Reminders and Notes to _iCloud_, I checked this from System Preferences >> iCloud.

P.S.: _I am on Mac OS El Capitan (10.11.6 (15G1108))_

I Signed out of iCloud, just to make sure nothing is syncing, took a fresh clone, repeated the steps. Still, build is stopping mid way.

_P.S: on same machine, Android Build is working without any problem, so, to me it looks like not 'sync' issue. Something to do with either xcode cli/cordova cli/ionic cli_

@ravishtiwari : Yea you are right it is sounds like ionic cli . Since you have newer cordova cli why do not try cordova rm platform/add/build/run ??

@emint88 - doing cordova platform remove/add ios/ cordova build ios seems to be working, with some error for cordova-plugin-push, I am not sure if it's related or not. Another thing is, there is not cordova state reset to reset the entire platform and cordova platform add ios does not seems to be installing all related plugins from package.json :(

I will do some more test around this and report back if build+run works for me with cordova command.

Thanks.

@emint88 - cordova build commands working for me, for android as well as ios. It's certainly some issue with Ionic CLI.

Thanks for you help. This issue isn't resolved with ionic, but, cordova cli work around is working for me.

Thanks for the issue! This issue appears to be associated with an old version of the Ionic CLI. Please update to the latest CLI version, which supports all versions of the Ionic Framework. If the issue is relevant and if it persists after updating to the latest CLI version, please create a new issue.

Thank you for using Ionic!

Was this page helpful?
0 / 5 - 0 ratings