Build ios failed


#1

Hi

When I use

ionic cordova build ios

I get a failed build with a message:

        Error Domain=IDEProvisioningErrorDomain Code=9 ""MyApp.app" requires a provisioning profile with the 
        Push Notifications feature." UserInfo={NSLocalizedDescription=MyApp.app" requires a provisioning 
        profile with the Push Notifications feature., NSLocalizedRecoverySuggestion=Add a profile to the 
        "provisioningProfiles" dictionary in your Export Options property list.}

But I’ve double checked the provision profiles (development and deploy) in xcode and both have the aps-environment.

My ionic info:

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

global packages:

    cordova (Cordova CLI) : 7.0.1 
    Gulp CLI              : CLI version 3.9.1 Local version 3.9.1

local packages:

    Cordova Platforms : android 6.2.1 ios 4.4.0
    Ionic Framework   : unknown

System:

    ios-deploy : 1.9.2 
    ios-sim    : 5.0.6 
    Node       : v6.11.2
    npm        : 3.10.10 
    OS         : macOS Sierra
    Xcode      : Xcode 9.0 Build version 9A235 

Misc:

    backend : pro

What am I missing here?


#2

Do you have an apple developer account? Does that account have an apple push services certificate generated? Are you using a production profile, development profile? Ad-hoc profile?

Creating and using an ad-hoc profile solved many of my problems when it came to integrating and using push services. Shockingly, apple is not very transparent about that useful piece of information.

Does your project, in your platform iOS folder, have the aps-environment key in its entitlements?


#3

Yeah … it’s all there.

So now, I’ve removed ios and then add it back again. tried to compile again. Now I get

Running command: /Volumes/Seagate2TB/projects/mycompany/ionic/MyApp/hooks/after_prepare/010_add_platform_class.js /Volumes/Seagate2TB/projects/mycompany/ionic/MyApp

add to body class: platform-ios

> cordova build ios
✖ Running command - failed!
[ERROR] An error occurred while running cordova build ios (exit code 1):

        
        (truncated) ... 
        erivedData/MyApp-dxuzvfxjipjzpjaryzlffemmbnkn/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Debug-iphoneos/Protobuf 
        -L/Users/coreelements/Library/Developer/Xcode/DerivedData/MyApp-dxuzvfxjipjzpjaryzlffemmbnkn/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Debug-iphoneos/nanopb 
        -F/Volumes/Seagate2TB/projects/mycompany/ionic/MyApp/platforms/ios/build/device 
        -F/Volumes/Seagate2TB/projects/mycompany/ionic/MyApp/platforms/ios/Pods/FirebaseAnalytics/Frameworks 
        -F/Volumes/Seagate2TB/projects/mycompany/ionic/MyApp/platforms/ios/Pods/FirebaseCore/Frameworks 
        -F/Volumes/Seagate2TB/projects/mycompany/ionic/MyApp/platforms/ios/Pods/FirebaseInstanceID/Frameworks 
        -F/Volumes/Seagate2TB/projects/mycompany/ionic/MyApp/platforms/ios/Pods/FirebaseMessaging/Frameworks 
        -filelist 
        /Users/coreelements/Library/Developer/Xcode/DerivedData/MyApp-dxuzvfxjipjzpjaryzlffemmbnkn/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/MyApp.LinkFileList 
        -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker 
        -object_path_lto -Xlinker 
        /Users/coreelements/Library/Developer/Xcode/DerivedData/MyApp-dxuzvfxjipjzpjaryzlffemmbnkn/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/MyApp_lto.o 
        -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -final_output -Xlinker 
        /Applications/MyApp.app/MyApp -fobjc-arc -fobjc-link-runtime -ObjC -ObjC 
        -lGoogleToolboxForMac -lProtobuf -lc++ -lnanopb -lsqlite3 -lz -framework AddressBook -framework 
        FirebaseAnalytics -framework FirebaseCore -framework FirebaseCoreDiagnostics -framework FirebaseInstanceID 
        -framework FirebaseMessaging -framework FirebaseNanoPB -framework StoreKit -framework SystemConfiguration -ObjC 
        -lGoogleToolboxForMac -lProtobuf -lc++ -lnanopb -lsqlite3 -lz -framework AddressBook -framework 
        FirebaseAnalytics -framework FirebaseCore -framework FirebaseCoreDiagnostics -framework FirebaseInstanceID 
        -framework FirebaseMessaging -framework FirebaseNanoPB -framework StoreKit -framework SystemConfiguration 
        /Volumes/Seagate2TB/projects/mycompany/ionic/MyApp/platforms/ios/build/device/libCordova.a 
        -weak_framework SystemConfiguration -framework CoreTelephony -weak_framework Social -weak_framework MessageUI 
        -lPods-MyApp -Xlinker -dependency_info -Xlinker 
        /Users/coreelements/Library/Developer/Xcode/DerivedData/MyApp-dxuzvfxjipjzpjaryzlffemmbnkn/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/MyApp_dependency_info.dat 
        -o 
        /Users/coreelements/Library/Developer/Xcode/DerivedData/MyApp-dxuzvfxjipjzpjaryzlffemmbnkn/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/MyApp
        ld: warning: directory not found for option 
        '-L/Users/coreelements/Library/Developer/Xcode/DerivedData/MyApp-dxuzvfxjipjzpjaryzlffemmbnkn/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Debug-iphoneos/GoogleToolboxForMac'
        ld: warning: directory not found for option 
        '-L/Users/coreelements/Library/Developer/Xcode/DerivedData/MyApp-dxuzvfxjipjzpjaryzlffemmbnkn/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Debug-iphoneos/Protobuf'
        ld: warning: directory not found for option 
        '-L/Users/coreelements/Library/Developer/Xcode/DerivedData/MyApp-dxuzvfxjipjzpjaryzlffemmbnkn/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Debug-iphoneos/nanopb'
        
        ** ARCHIVE FAILED **
        
        
        The following build commands failed:
        	Ld 
        /Users/coreelements/Library/Developer/Xcode/DerivedData/MyApp-dxuzvfxjipjzpjaryzlffemmbnkn/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyApp 
        normal arm64
        (1 failure)
        Error: Error code 65 for command: xcodebuild with args: 
        -xcconfig,/Volumes/Seagate2TB/projects/mycompany/ionic/MyApp/platforms/ios/cordova/build-debug.xcconfig,-workspace,MyApp.xcworkspace,-scheme,MyApp,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,MyApp.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Volumes/Seagate2TB/projects/mycompany/ionic/MyApp/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Volumes/Seagate2TB/projects/mycompany/ionic/MyApp/platforms/ios/build/sharedpch

#4

So … I got it working again. I turns out the cocapods needed to be download again.

So I navigated to the ios folder and did

pod install

Next problem was the duplicate symbol errors. I solved that (https://stackoverflow.com/questions/30882312/duplicate-symbol-kcdvfilesystemurlprefix-when-adding-cordova-file-plugin-to-exi)

Click on your Project Navigator from XCode.

Click on BuildSettings from it.

Find No Common Blocks in it and set it to No.

#5

Well … turns out I was to soon. The problem lies in that cordova-ios doesn’t properly exports xcode9 style exportOptions.plist. Waiting is on a PR