Build error when building iPad app for UIKitForMac - swift

When attempting to build an iPad app for Mac using Catalyst, I get the following error:
FirebaseAnalytics.framework/FirebaseAnalytics(...o),
building for UIKitForMac, but linking in object file built for iOS Simulator,
file '/../FirebaseAnalytics.framework/FirebaseAnalytics' for architecture x86_64
Is this something Google has to fix? The version is FirebaseAnalytics 6.0.1

The Firebase libraries are not yet ported to UIKitForMac / Catalina, so it's best to conditionally compile out the usages like so:
#if !targetEnvironment(UIKitForMac)
...firebase code...
#endif

Related

Failed to build Flutter app in iOS emulator for architecture arm64

I am encounter this error when first time I build my flutter app in iOS simulator (it works normally on android)
Device: MacbookAir M1
Flutter: 3.3.10
Xcode: 14.2
In
/Users/paramaartha/Documents/Flutter/komplekku_user/ios/Pods/Sodium/Sodium/libsodium/libsodium-io
s.a(libsodium_la-aead_chacha20poly1305.o), building for iOS Simulator, but linking in object file
built for iOS, file
'/Users/paramaartha/Documents/Flutter/komplekku_user/ios/Pods/Sodium/Sodium/libsodium/libsodium-i
os.a' for architecture arm64
Anyone know how to fix it?
I tried to add exclude architecture and run Xcode in rosseta but nothing work

Building Flutter sqflite ios app using codemagic.io

My flutter app works fine on android emulator and I am using codemagic.io to build the ios version since I am on windows.
However, when trying to build the ios app, the site is showing the following error and I think it has to do with sqflite.
As far as I understand, I guess, I have to change the minimum targeted ios version but actually I don't know how to do it. Any help would be much appreciated.
Xcode's output:
↳
/Users/builder/clone/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.m:101:9: warning: 'dispatch_queue_set_specific' **is only available on iOS 5.0 or newer** [-Wunguarded-availability]
dispatch_queue_set_specific(_queue, kDispatchQueueSpecificKey, (__bridge void *)self, NULL);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
In module 'Foundation' imported from /Users/builder/clone/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.h:9:
In module 'CoreFoundation' imported from /Applications/Xcode-11.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Dispatch' imported from /Applications/Xcode-11.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.4.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:
/Applications/Xcode-11.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.4.sdk/usr/include/dispatch/queue.h:1498:1: **note: 'dispatch_queue_set_specific' has been marked as being introduced in iOS 5.0 here, but the deployment target is iOS 4.3.0**
dispatch_queue_set_specific(dispatch_queue_t queue, const void *key,
^
/Users/builder/clone/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.m:101:9: note: enclose 'dispatch_queue_set_specific' in an #available check to silence this warning
dispatch_queue_set_specific(_queue, kDispatchQueueSpecificKey, (__bridge void *)self, NULL);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/builder/clone/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.m:184:54: warning: 'dispatch_get_specific' **is only available on iOS 5.0 or newer** [-Wunguarded-availability]
FMDatabaseQueue *currentSyncQueue = (__bridge id)dispatch_get_specific(kDispatchQueueSpecificKey);
I reinstalled flutter and that solved the problem

Distribute Universal framework written in Swift

I'm facing the issue with distributing compiled swift framework. My framework heavily relies on the libxml2 dynamic library. In order to avoid issues with Swift module compatibility, I've set build flag BUILD_LIBRARY_FOR_DISTRIBUTION = YES.
So I've used Xcode 11.3 Swift v5.1.3 to build my framework. I've integrated it into the Demo.app project. As being expected Demo.app works fine in Xcode 11.3.
However, I have another error trying to build Demo.app in Xcode 11.0 Swift 5.1.
I've got the error:
#import "libxml/HTMLparser.h"
^
/Applications/Xcode_11.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator13.0.sdk/usr/include/libxml2/libxml/HTMLparser.h:15:10: error: 'libxml/xmlversion.h' file not found
#include <libxml/xmlversion.h>
^
/.../DemoApp/ThirdParty/testXML.framework/Modules/testXML.swiftmodule/x86_64-apple-tvos-simulator.swiftinterface:6:8: error: could not build Objective-C module 'libxml2'
import libxml2
^
/.../DemoApp/AppDelegate.swift:11:8: error: failed to load module 'testXML'
import testXML
Here is the repo with both framework and app projects.
I'm using both Xcode version on the same Mac.
Your project runs fine on my Xcode 11.3 tvOS simulator. However there's something I've noticed.
The framework you built only contains x86_64 architectures (simulator only), it won't work on physical devices.
For Xcode before 11.3 it seems like you need to add $(SDKROOT)/usr/include/libxml2 and ${SRCROOT}/libxml2 to Build Settings. That fixed the issue for me on Xcode 11.2.1

Could not find module 'SJSegmentedScrollView' for architecture 'armv7'; found: arm64

The problem shows when I try to build to real device as simulator. But, there's no problem when I build in simulator.
XCode : 10.2.1
Swift : 4.0
iOS : 10.3.3
Can you check if you are using Debug or Release to build? I've had a similar issue before with other modules, for example you can run the Onfido SDK on simulators on Debug but not on Release. By the looks of this error you are using the Release SDK.

clang: error no such file or directory: */Debug-iphonesimulator/MailCore/MailCore

I am using mailcore2 in my ios app from fetching my gmail account emails on my device. I have changed the ios sdkversion from 6.1 to 6.0 in the mailcore2 scripts bcz I am trying to compile and run the app using iPhone simulator 6.0 which uses ios sdkversion 6.0. Doing so I am getting the following clang error.
clang: error: no such file or directory: '/Users/shujaat/Library/Developer/Xcode/DerivedData/MyTestApp-ditognlaoajwldfliplqecnxqbfj/Build/Products/Debug-iphonesimulator/MailCore/MailCore'
While trying to compile and run my app using iphone simulator 6.1 (uses ios sdk 6.1), with no changes in the ios sdk version in the shell scripts, I am getting the following error:
/bin/sh /Users/shujaat/Documents/WemoTech/Products/WantList/sourcecode/ThirdPartyLib/MailCore2/Externals/builds/workdir/20130930192723/src/libetpan/build-mac/update.sh
configuring
running prepare-cyrus-sasl.sh
prepare sources
patching file lib/client.c
building tools
generated makemd5i386 properly
building for iPhoneOS - armv7
CONFIGURE FAILED
Command /bin/sh failed with exit code 1
These issues are driving me crazy for the last couple of days. Need your help.
Go to your main project target->"Build phases"->"Target dependencies" add mailcore2 ios
You need to read Check Adding MailCore to Your iOS Project carefully.
These issues are fixed now. I want to explain what I did to get rid of them for others facing same issues:
I made a separate project, and made mailcore2 as a part of it (didn't include the #import line in any of the project files at first). I compiled and run the project and copied the resultant mailcore 2 from it to my original project. It's compiling and running fine now.