No such module 'Amplify' & Could not read serialized diagnostics file: error("Invalid diagnostics signature") - ios

I'm trying to compile an Xcode project. I'm getting 2 runtime errors:
No such module 'Amplify'
&
/Users/????????/Library/Developer/Xcode/DerivedData/screener_app-gkvpndyzdgqrsreqyokgisatdzav/Build/Intermediates.noindex/screener_app.build/Debug-iphonesimulator/screener_app.build/Objects-normal/x86_64/AuthButtonView.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'screener_app' from project 'screener_app') Command CompileSwift failed with a nonzero exit code
The screenshot is seen below.
I have tried a handful of things:
cleaned build folder
install/update pods
removed derived data
I'm not sure what to do from here. Any advice is appreciated.
Edit: I am seeing that the workspace is compiling but the project folder is not.

Related

React Native (Expo) - error: generate-pch command failed with exit code 1

Building a React Native Expo app (prebuild on iOS, not using Expo Go) and running into this esoteric error that I can't seem to find elsewhere on the internet.
I'll post it here for the next unlucky React Native dev, and perhaps I'll find a solution and post that too.
expo run:ios output:
⚠️ (../../Library/Developer/Xcode/DerivedData/MyProject-epxolwjjgmimbdefugnlecrdysuv/Build/Intermediates.noindex/PrecompiledHeaders/MyProject-Bridging-Header-2vyenlvwppgam.dia:1:1)
Command PrecompileSwiftBridgingHeader failed with a nonzero exit code
^ Could not read serialized diagnostics file: error(in target 'MyProject' from project 'MyProject')
❌ error: generate-pch command failed with exit code 1 (use -v to see invocation)
› 1 error(s), and 1 warning(s)
Failed to build iOS project. "xcodebuild" exited with error code 65.
Xcode build output:
<unknown>:0: error: error opening input file '/Users/jh/Code/MyProject/ios/MyProject/MyProject-Bridging-Header.h' (No such file or directory)
<unknown>:0: error: cannot open file '/Users/jh/Library/Developer/Xcode/DerivedData/MyProject-epxolwjjgmimbdefugnlecrdysuv/Build/Intermediates.noindex/PrecompiledHeaders/MyProject-Bridging-Header-e8n926ydzbc0.dia' for diagnostics emission (No such file or directory)
/Users/jh/Library/Developer/Xcode/DerivedData/MyProject-epxolwjjgmimbdefugnlecrdysuv/Build/Intermediates.noindex/PrecompiledHeaders/MyProject-Bridging-Header-e8n926ydzbc0.dia:1:1: warning: Could not read serialized diagnostics file: error("Failed to open diagnostics file") (in target 'MyProject' from project 'MyProject')
Command PrecompileSwiftBridgingHeader failed with a nonzero exit code
Expo SDK version 44. I'm on a 2022 Mac Studio M1.
Okay, found the solution!
I had used npx react-native-rename to rename my project, but it didn't rename the Swift bridging header.
It's located in ios/MyProject/<oldname>-Bridging-Header.h.
renamed: ios/MyProject/OldName-Bridging-Header.h -> ios/MyProject/MyProject-Bridging-Header.h
While I was doing this, I also discovered that several of my bundle identifiers hadn't been moved over either. Do a codebase search for com.yourorganization.youroldbundlename to find & replace those too.
The locations I had to update:
./ios/MyProject.xcodeproj/project.pbxproj
./ios/MyProject/Info.plist
./app.json

Azure pipeline fails during xcode build for iOS project

Trying to build iOS project with xcode build. Using -
Xcode 12.4
Agent Specification - macOS-10.15
Workspace or project path - Project.xcworkspace
Configuration - Release (Tried with Debug also, it gives more error)
Scheme -valid name
SDK - iphoneos
Now After xcode build using Azure pipeline give following error.
We can build this xcode on locally and Gitlab too. But same code is failing on Azure Devops.
Kindly help.
2021-05-12T13:00:30.6465950Z ❌ /Users/runner/work/1/s/Project/Framework/csdk_common.framework/Modules/module.modulemap:2:19: umbrella header 'csdk_common.h' not found
2021-05-12T13:00:30.6466920Z
2021-05-12T13:00:30.6468430Z umbrella header "csdk_common.h"
2021-05-12T13:00:30.6471390Z ^
2021-05-12T13:00:30.6471830Z
2021-05-12T13:00:30.6472160Z
2021-05-12T13:00:30.6472470Z
2021-05-12T13:00:30.6473810Z ❌ /Users/runner/work/1/s/Project/TTS/main_internal.swift:2:8: could not build Objective-C module 'csdk_common'
2021-05-12T13:00:30.6474420Z
2021-05-12T13:00:30.6475000Z import csdk_common
2021-05-12T13:00:30.6475580Z ^
2021-05-12T13:00:30.6475930Z
2021-05-12T13:00:30.6476250Z
2021-05-12T13:00:30.6730310Z ** BUILD FAILED **
2021-05-12T13:00:30.6731680Z
2021-05-12T13:00:30.6732100Z
2021-05-12T13:00:30.6732840Z The following build commands failed:
2021-05-12T13:00:30.6733510Z CompileSwift normal arm64
2021-05-12T13:00:30.6740330Z CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
2021-05-12T13:00:30.6746120Z (2 failures)
2021-05-12T13:00:30.7025590Z ##[error]Error: /usr/bin/xcodebuild failed with return code: 65
2021-05-12T13:00:30.7365340Z ##[section]Finishing: Xcode build
Please check the repos branch, and make sure you have added this under framework header file. Maybe you did not push the right project and necessary part into the azure devops repos.
#import "xxx\csdk_common.h"
More info you could check this issue and that.

How come flutter build ios --obfuscate --split-debug-info= failed with warnings, but flutter build ios works?

Please know that flutter build ios works perfectly without any warning or error.
But when I do flutter build ios --obfuscate --split-debug-info=/_app/obfuscate
it failed with this error :
Building com.x.app for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: YSHDK23K
Running pod install...                                             18.9s
Running Xcode build...                                                  
                                                   
Xcode build done.                                           515.9s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
   /_app/ios/Pods/libwebp/src/dsp/dec_neon.c:1462:38: warning:
    variable 'sum_left' may be uninitialized when used here [-Wconditional-uninitialized]
        const uint16x8_t sum = vaddq_u16(sum_left, sum_top);
                                         ^~~~~~~~
   /_app/ios/Pods/libwebp/src/dsp/dec_neon.c:1426:3: note: variable
    'sum_left' is declared here
      uint16x8_t sum_left;
      ^
   /_app/ios/Pods/libwebp/src/dsp/dec_neon.c:1462:48: warning:
    variable 'sum_top' may be uninitialized when used here [-Wconditional-uninitialized]
        const uint16x8_t sum = vaddq_u16(sum_left, sum_top);
                                                   ^~~~~~~
   /_app/ios/Pods/libwebp/src/dsp/dec_neon.c:1425:3: note: variable
    'sum_top' is declared here
      uint16x8_t sum_top;
     
...... ======= <Warnings Truncated> ========= .......
    /Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_image_compress-0.6.5+1/ios/Classes/SYP
    ictureMetadata/SYMetadataExif.m:9:9: warning: non-portable path to file '"SYMetadataExif.h"'; specified path differs in
    case from file name on disk [-Wnonportable-include-path]
    #import "SYMetadataEXIF.h"
            ^~~~~~~~~~~~~~~~~~
            "SYMetadataExif.h"
    1 warning generated.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
Encountered error while building for device.
I got an error from Stackoverflow thus cannot submit without truncating the warnings, thus I cut it off in the middle. If you need more of those warnings please ask me and I will send it to you..
What am I missing here? The app and all works fine even in release mode. It is only when I add the --obfuscate flag it is like this.
Finally I solved this problem. But the solution is tedious and I'm not sure if this is the best solution. But I think this is the robust solution:
Delete Flutter entirely from your computer
Reinstall flutter with the latest version.
In the ios folder of your project directory, delete "Podfile" file, "Podfile.lock" file, and "Pods" directory.
Do flutter clean in your project directory.
Then rerun the app as intended.
Then it works... at least for me.
Anyone else has other solution?
Clean all unwanted files,
run this command from a terminal
flutter clean && rm ios/Podfile ios/Podfile.lock pubspec.lock && rm -rf ios/Pods ios/Runner.xcworkspace

xcodebuild build command fails in Xcode 11.5

when build the app in xcode 11.5 generate this issue.
LOG: I hope can help me!! Regards!!
warning: Could not read serialized diagnostics file: Cannot Load File: Failed to open diagnostics file (in target 'B7_MOCHA' from project 'B7_MOCHA')
warning: Could not read serialized diagnostics file: Cannot Load File: Failed to open diagnostics file (in target 'B7_MOCHA' from project 'B7_MOCHA')
warning: Could not read serialized diagnostics file: Cannot Load File: Failed to open
diagnostics file (in target 'B7_MOCHA' from project 'B7_MOCHA')
:0: error: unable to execute command: Killed: 9
:0: error: compile command failed due to signal 9 (use -v to see invocation)
Command CompileSwiftSources failed with a nonzero exit code
this a picture from console log:
the other console show this issue
/Users/dverdugo/Library/Developer/Xcode/DerivedData/B7_MOCHA-asiprqvqhlstshfnhycalolsjhxs/Build/Intermediates.noindex/B7_MOCHA.build/Debug-iphoneos/B7_MOCHA.build/Objects-normal-asan/arm64/TAG_CHAT.dia:1:1: Could not read serialized diagnostics file: Cannot Load File: Failed to open diagnostics file
I hope can help me!! Regards!!
Sometimes the best thing you need to do is
-Close xcode.
-Restar the Mac
-check if the pods you are using installed well.
and for the second error, maybe you deleted some file in the folder of your project so xcode is looking for it and can't find it.

Facebook sdk not working if I place the sdk folder inside react-native project?

I am wanting to manually link the Facebook SDK because we don't use cocoapods & don't want to implement it. But for some reason when we build our app on buddybuild, it will fail.
What I've done is placed the FacebookSDK folder inside (not an optimal solution I know):
ios/<ProjectName>/FacebookSDK
I added this folder ($(SRCROOT)/ios/<ProjectName>/FacebookSDK) to the framework search header paths & it still seems to throw errors.
1850
▸ Compiling RCTFBSDKShareDialog.m
1851
» In file included from node_modules/react-native-fbsdk/ios/RCTFBSDK/share/RCTFBSDKShareDialog.m:19:
1852
✗ node_modules/react-native-fbsdk/ios/RCTFBSDK/share/RCTFBSDKShareDialog.h:21:9: fatal error: 'FBSDKShareKit/FBSDKShareKit.h' file not found
1853
» #import <FBSDKShareKit/FBSDKShareKit.h>
1854
» ^
1855
▸ Compiling RCTFBSDKAppEvents.m
1856
» In file included from node_modules/react-native-fbsdk/ios/RCTFBSDK/core/RCTFBSDKAppEvents.m:19:
1857
✗ node_modules/react-native-fbsdk/ios/RCTFBSDK/core/RCTFBSDKAppEvents.h:21:9: fatal error: 'FBSDKCoreKit/FBSDKCoreKit.h' file not found
1858
» #import <FBSDKCoreKit/FBSDKCoreKit.h>
1859
» ^
1860
** BUILD FAILED **
1861
The following build commands failed:
1862
CompileC /tmp/sandbox/582d62aa1d76fc0100f1f6dd/bbbuild/Build/Intermediates/RCTFBSDK.build/Release-iphoneos/RCTFBSDK.build/Objects-normal/armv7/RCTFBSDKAppEvents.o RCTFBSDK/core/RCTFBSDKAppEvents.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
1863
(1 failure)
Any ideas to what I can do? It'd be nice if we could use this solution for now so that all developers (and the buddybuild CI) can pull it instead of having to download the SDK and put it documents folder.
This is generally a result of an incorrectly configured repository with regards to the location of FBSDK dependencies.
If you take a look at: https://github.com/facebook/react-native-fbsdk/blob/master/ios/RCTFBSDK.xcodeproj/project.pbxproj
You will notice that RCTFBSDK will look for dependencies in one of two locations:
~/Documents/FacebookSDK
$(PROJECT_DIR)/../../../ios/Frameworks
The second option is the correct option for continuous integration systems like buddybuild.
In other words, you MUST place your FBSDK dependencies under the "ios/Frameworks" folder in order for it to work on a continuous integration system.
You can find more information about this in our react-native documentations.
Please let me know if this helps!

Resources