Unable to launch iOS application in swift with carthage frameworks
See original GitHub issueHi there,
I’ve been quite impressed by how fast buck builds iOS (and Android) applications, and decided to take the plunge. I’ve been working on deintegrating cocoapods and moving everything to use Carthage/static frameworks. I’m facing a launch error though when I try to run buck install
where the application builds and starts to run but then immediately closes without any sort of error.
This is what happens when I run it
The application appears in my simulator, and then opens and closes. Clicking on the icon after that has the effect (opens then closes)
My .BUCK
file looks like that:
# iOS
apple_asset_catalog(
name = 'JarvisAssets',
app_icon = 'AppIcon',
dirs = ['jarvis/Assets.xcassets'],
)
apple_resource(
name = 'JarvisResources',
dirs = [],
files = glob(['jarvis/*.png','jarvis/*.storyboard', 'jarvis/*.xib', 'jarvis/Fonts/*.ttf', 'jarvis/Geomanist OTF/*.otf']),
)
apple_binary(
name = 'JarvisBinary',
configs = {
'Development': {
'PRODUCT_NAME' : 'Jarvis',
'PRODUCT_MODULE_NAME' : 'jarvis',
'CLANG_ENABLE_MODULES' : 'YES',
'PROVISIONING_PROFILE_SPECIFIER' : '',
'DEVELOPMENT_TEAM' : 'xxx',
'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES' : 'YES',
'PRODUCT_BUNDLE_IDENTIFIER' : 'xxx',
'ONLY_ACTIVE_ARCH' : 'YES',
'CODE_SIGN_ENTITLEMENTS' : 'jarvis/jarvis.entitlements',
'SWIFT_OPTIMIZATION_LEVEL' : '-Onone',
'GCC_OPTIMIZATION_LEVEL' : '0',
'VALIDATE_PRODUCT' : 'NO',
},
},
preprocessor_flags = [
'-fobjc-arc',
'-fno-objc-arc-exceptions',
'-Qunused-arguments',
],
srcs = glob([
'jarvis/**/*.m',
'jarvis/**/*.mm',
'jarvis/**/*.swift',
]),
headers = glob([
'jarvis/**/*.h',
]),
bridging_header = 'jarvis/Jarvis-Bridging-Header.h',
frameworks = [
'$SDKROOT/System/Library/Frameworks/SystemConfiguration.framework',
'$SDKROOT/System/Library/Frameworks/OpenGLES.framework',
'$SDKROOT/System/Library/Frameworks/AVFoundation.framework',
'$SDKROOT/System/Library/Frameworks/Foundation.framework',
'$SDKROOT/System/Library/Frameworks/UIKit.framework',
'$SDKROOT/System/Library/Frameworks/CoreMotion.framework',
'$SDKROOT/System/Library/Frameworks/CoreLocation.framework',
'$SDKROOT/System/Library/Frameworks/MobileCoreServices.framework',
'$SDKROOT/System/Library/Frameworks/CoreMedia.framework',
'$SDKROOT/System/Library/Frameworks/CFNetwork.framework',
],
visibility = ['PUBLIC'],
deps = [
':JarvisAssets',
':JarvisResources',
':Fabric',
':Answers',
':Nimble',
':Quick',
':Sentry',
':Crash',
':AppleCalendar',
':CryptoSwift',
':JWT',
':KeychainAccess',
':Alamofire',
':AlamofireObjectMapper',
':Charts',
':EPSignature',
':IQKeyboardManager',
':IQKeyboardManagerSwift',
':ObjectMapper',
':calabash',
':ZDCChat',
':ZDCChatAPI',
],
)
apple_bundle(
name = 'Jarvis',
binary = ':JarvisBinary',
extension = 'app',
info_plist = 'jarvis/Info.plist',
)
apple_package(
name = 'JarvisPackage',
bundle = ':Jarvis',
)
prebuilt_apple_framework(
name = 'Fabric',
preferred_linkage = 'shared',
framework = 'Fabric.framework',
)
prebuilt_apple_framework(
name = 'Answers',
preferred_linkage = 'shared',
framework = 'Answers.framework',
)
prebuilt_apple_framework(
name = 'Nimble',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/Nimble.framework',
)
prebuilt_apple_framework(
name = 'Quick',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/Quick.framework',
)
prebuilt_apple_framework(
name = 'Sentry',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/Sentry.framework',
)
prebuilt_apple_framework(
name = 'Crash',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/KSCrash.framework',
)
prebuilt_apple_framework(
name = 'AppleCalendar',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/JTAppleCalendar.framework',
)
prebuilt_apple_framework(
name = 'CryptoSwift',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/CryptoSwift.framework',
)
prebuilt_apple_framework(
name = 'JWT',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/JWT.framework',
)
prebuilt_apple_framework(
name = 'KeychainAccess',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/KeychainAccess.framework',
)
prebuilt_apple_framework(
name = 'Alamofire',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/Alamofire.framework',
)
prebuilt_apple_framework(
name = 'AlamofireObjectMapper',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/AlamofireObjectMapper.framework',
)
prebuilt_apple_framework(
name = 'Charts',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/Charts.framework',
)
prebuilt_apple_framework(
name = 'EPSignature',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/EPSignature.framework',
)
prebuilt_apple_framework(
name = 'IQKeyboardManager',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/IQKeyboardManager.framework',
)
prebuilt_apple_framework(
name = 'IQKeyboardManagerSwift',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/IQKeyboardManagerSwift.framework',
)
prebuilt_apple_framework(
name = 'ObjectMapper',
preferred_linkage = 'shared',
framework = 'Carthage/Build/iOS/ObjectMapper.framework',
)
prebuilt_apple_framework(
name = 'calabash',
preferred_linkage = 'shared',
framework = 'calabash.framework',
)
prebuilt_apple_framework(
name = 'ZDCChat',
preferred_linkage = 'shared',
framework = 'ZDCChat/ZDCChat.framework',
)
prebuilt_apple_framework(
name = 'ZDCChatAPI',
preferred_linkage = 'shared',
framework = 'ZDCChat/ZDCChatAPI.framework',
)
and my .buckconfig
is as follows:
[cache]
mode = dir
dir_max_size = 512MB
[cxx]
cflags = -std=gnu11
cxxflags = -std=c++14 -stdlib=libc++
default_platform = iphonesimulator-x86_64
combined_preprocess_and_compile = true
[project]
ide = xcode
ignore = \
.git, \
.hg, \
.buckd
[swift]
version = 3.0
iOS Simulator Log:
May 11 15:05:03 hostname assertiond[21905]: Submitted job with label: UIKitApplication:xxx[0xe80a][21905]
May 11 15:05:03 hostname SpringBoard[21899]: [xxx] Bootstrap complete with label: UIKitApplication: xxx[0xe80a][21905]
May 11 15:05:03 hostname com.apple.CoreSimulator.SimDevice.3F116BC8-F7F1-4AC5-AC54-F1A7E7EDF8FE.launchd_sim[21875] (UIKitApplication: xxx[0xe80a][21905][47621]): Service exited due to Abort trap: 6
May 11 15:05:03 hostname assertiond[21905]: Deleted job with label: UIKitApplication: xxx[0xe80a][21905]
Would love to get some clue as to why I’m having this issue. Been pouring over documentation and issues but have so far been unable to figure out what’s wrong. Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:17 (7 by maintainers)
Top GitHub Comments
@acecilia I don’t work on buck anymore, but see my previous comment for an explanation why transitive prebuilt_apple_framework deps are not automatically copied into the bundle: https://github.com/facebook/buck/issues/1339#issuecomment-302251485
@nikhilsh There is a “hack” you need to do. You have to copy the carthage frameworks you’re using to a folder called
Frameworks
and use it as aapple_resource
in youapple_bundle
.In your case, it would be something like this: