Xcode unittest build failed with error “Undefined symbols for architecture x86_64”
My unittest target build failed with below error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_MCStore", referenced from:
objc-class-ref in MCStoreTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Basic information:
- Xcode6.2
- iOS8.2 SDK
What I have checked:
Symbols Hidden by Default
is No
Other Linker Flags
is -framework XCTest
Framework Search Paths
is $(SDKROOT)/Developer/Library/Frameworks $(inherited)
ios xcode
add a comment |
My unittest target build failed with below error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_MCStore", referenced from:
objc-class-ref in MCStoreTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Basic information:
- Xcode6.2
- iOS8.2 SDK
What I have checked:
Symbols Hidden by Default
is No
Other Linker Flags
is -framework XCTest
Framework Search Paths
is $(SDKROOT)/Developer/Library/Frameworks $(inherited)
ios xcode
Where is theMCStore
class implemented?
– Droppy
Jun 19 '15 at 10:30
it's implemented in my application target.
– Yuwen Yan
Jun 19 '15 at 10:31
And the test target includes that implementation file?
– Droppy
Jun 19 '15 at 10:32
No, I have added my application target to the unittest target dependencies
– Yuwen Yan
Jun 19 '15 at 10:36
add a comment |
My unittest target build failed with below error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_MCStore", referenced from:
objc-class-ref in MCStoreTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Basic information:
- Xcode6.2
- iOS8.2 SDK
What I have checked:
Symbols Hidden by Default
is No
Other Linker Flags
is -framework XCTest
Framework Search Paths
is $(SDKROOT)/Developer/Library/Frameworks $(inherited)
ios xcode
My unittest target build failed with below error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_MCStore", referenced from:
objc-class-ref in MCStoreTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Basic information:
- Xcode6.2
- iOS8.2 SDK
What I have checked:
Symbols Hidden by Default
is No
Other Linker Flags
is -framework XCTest
Framework Search Paths
is $(SDKROOT)/Developer/Library/Frameworks $(inherited)
ios xcode
ios xcode
edited Nov 22 '18 at 2:35
Cœur
18.3k9109148
18.3k9109148
asked Jun 19 '15 at 10:16
Yuwen YanYuwen Yan
1,89112445
1,89112445
Where is theMCStore
class implemented?
– Droppy
Jun 19 '15 at 10:30
it's implemented in my application target.
– Yuwen Yan
Jun 19 '15 at 10:31
And the test target includes that implementation file?
– Droppy
Jun 19 '15 at 10:32
No, I have added my application target to the unittest target dependencies
– Yuwen Yan
Jun 19 '15 at 10:36
add a comment |
Where is theMCStore
class implemented?
– Droppy
Jun 19 '15 at 10:30
it's implemented in my application target.
– Yuwen Yan
Jun 19 '15 at 10:31
And the test target includes that implementation file?
– Droppy
Jun 19 '15 at 10:32
No, I have added my application target to the unittest target dependencies
– Yuwen Yan
Jun 19 '15 at 10:36
Where is the
MCStore
class implemented?– Droppy
Jun 19 '15 at 10:30
Where is the
MCStore
class implemented?– Droppy
Jun 19 '15 at 10:30
it's implemented in my application target.
– Yuwen Yan
Jun 19 '15 at 10:31
it's implemented in my application target.
– Yuwen Yan
Jun 19 '15 at 10:31
And the test target includes that implementation file?
– Droppy
Jun 19 '15 at 10:32
And the test target includes that implementation file?
– Droppy
Jun 19 '15 at 10:32
No, I have added my application target to the unittest target dependencies
– Yuwen Yan
Jun 19 '15 at 10:36
No, I have added my application target to the unittest target dependencies
– Yuwen Yan
Jun 19 '15 at 10:36
add a comment |
7 Answers
7
active
oldest
votes
According to this link, I need to set Bundle Loader
with below content in unittest target Build Settings
$(BUILT_PRODUCTS_DIR)/MyExistingApp.app/MyExistingApp
helpful link, thanks
– Kate Geld
Oct 23 '15 at 14:03
2
This answer is a life-saver dude!!! I am so happy I have stumbled upon it!!! So many thanks!!!
– Soberman
Feb 16 '16 at 19:03
4
Why does this work? And why does this not work out of the box in XCode?
– yurgis
Nov 8 '16 at 0:50
3
These line are worth gold!!! Thanks very much. Helped me solving endless Mach-O linker errors in a project with unit-test, ui-test and different deployment targets.
– Darkglow
Jan 24 '17 at 11:12
2
I had to do this with a brand new project created with XCode 8.2.
– MdaG
Feb 4 '17 at 12:01
|
show 5 more comments
At least as of Xcode 7.3 test targets let you select a "Host Application". In the Test target (but not presently the UI Test target) this automatically populates the "Test Host" build setting, but not the "Bundle Loader", which can lead to classes not being found.
Considering this, if you set your test targets' "Bundle Loader" Build Setting to $(TEST_HOST)
, it will always contain the right value even if you change the Host Application.
This is effectively the opposite of the advice given in the link @yuwen-yan posted, and should amount to less work.
2
I found$(TEST_HOST)
to be the default configuration, however still one of my pods isn't found.
– Lars Blumberg
Jun 8 '16 at 9:27
1
In Xcode9.2, its now under Test target > Build settings > Testing > Test host. Adding $(TEST_HOST) still works. However, I also did update my cocoapods.
– quik_silv
Aug 2 '18 at 21:40
add a comment |
Experienced the same issue.
What fixed it for me was setting enable modules (c and objective-c)
to YES in the Testing target Build Settings
.
add a comment |
So here is what worked for me...
override func setUp() {
super.setUp()
let promise = expectation(description: "App has finished running")
DispatchQueue.global(qos: .background).async{
// Wait on the background thread
sleep(4)
DispatchQueue.main.async {
// Fullfill the promise in the main thread
promise.fulfill()
}
}
// Initialize the storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
// Get the view controller
sut = storyboard.instantiateViewController(withIdentifier: String(describing: ViewController.self)) as? ViewController
_ = sut.view
waitForExpectations(timeout: 5) { (_) in
// Finish set up after the app is done running its code
}
}// End setUp() Method
add a comment |
Experienced the same linker error after adding test target to old project which was created 2 or 3 XCode versions ago. Furthermore, project has various xcodeproject/target/bundle names. All possible renames, cleanings, Build settings
, Build phases
, Scheme
manipulations did not worked for me.
What did actually worked after a long struggle is recreating the project along with all targets from scratch in latest Xcode version. It finally links! And in this case you don't even need to manually modify Search paths
, Bundle loader
, Xcode will do it for you.
add a comment |
This error may be the result of having wrong test target type, namely ui test target.
UI test targets can't use the internals of the main target, not even with @testable
imports. Unit test targets OTOH can use the internals.
See more details in this answer.
(I believe this has changed in some XCode version which causes confusion. Typical way is just to include a huge bunch of files from the original target in the ui test target. A proper way is to design UI tests in such a way that they don't need or use much code from the main target.)
add a comment |
Below are the steps that I performed to fix the issue while trying to add unit test target in Xcode 9:
- Go to 'Manage Schemes'.
- Click on '+' button at the bottom.
- Select the newly added Target and select 'OK'.
- Make sure 'Shared' option is selected for the newly added target.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f30935640%2fxcode-unittest-build-failed-with-error-undefined-symbols-for-architecture-x86-6%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
According to this link, I need to set Bundle Loader
with below content in unittest target Build Settings
$(BUILT_PRODUCTS_DIR)/MyExistingApp.app/MyExistingApp
helpful link, thanks
– Kate Geld
Oct 23 '15 at 14:03
2
This answer is a life-saver dude!!! I am so happy I have stumbled upon it!!! So many thanks!!!
– Soberman
Feb 16 '16 at 19:03
4
Why does this work? And why does this not work out of the box in XCode?
– yurgis
Nov 8 '16 at 0:50
3
These line are worth gold!!! Thanks very much. Helped me solving endless Mach-O linker errors in a project with unit-test, ui-test and different deployment targets.
– Darkglow
Jan 24 '17 at 11:12
2
I had to do this with a brand new project created with XCode 8.2.
– MdaG
Feb 4 '17 at 12:01
|
show 5 more comments
According to this link, I need to set Bundle Loader
with below content in unittest target Build Settings
$(BUILT_PRODUCTS_DIR)/MyExistingApp.app/MyExistingApp
helpful link, thanks
– Kate Geld
Oct 23 '15 at 14:03
2
This answer is a life-saver dude!!! I am so happy I have stumbled upon it!!! So many thanks!!!
– Soberman
Feb 16 '16 at 19:03
4
Why does this work? And why does this not work out of the box in XCode?
– yurgis
Nov 8 '16 at 0:50
3
These line are worth gold!!! Thanks very much. Helped me solving endless Mach-O linker errors in a project with unit-test, ui-test and different deployment targets.
– Darkglow
Jan 24 '17 at 11:12
2
I had to do this with a brand new project created with XCode 8.2.
– MdaG
Feb 4 '17 at 12:01
|
show 5 more comments
According to this link, I need to set Bundle Loader
with below content in unittest target Build Settings
$(BUILT_PRODUCTS_DIR)/MyExistingApp.app/MyExistingApp
According to this link, I need to set Bundle Loader
with below content in unittest target Build Settings
$(BUILT_PRODUCTS_DIR)/MyExistingApp.app/MyExistingApp
answered Jun 19 '15 at 13:20
Yuwen YanYuwen Yan
1,89112445
1,89112445
helpful link, thanks
– Kate Geld
Oct 23 '15 at 14:03
2
This answer is a life-saver dude!!! I am so happy I have stumbled upon it!!! So many thanks!!!
– Soberman
Feb 16 '16 at 19:03
4
Why does this work? And why does this not work out of the box in XCode?
– yurgis
Nov 8 '16 at 0:50
3
These line are worth gold!!! Thanks very much. Helped me solving endless Mach-O linker errors in a project with unit-test, ui-test and different deployment targets.
– Darkglow
Jan 24 '17 at 11:12
2
I had to do this with a brand new project created with XCode 8.2.
– MdaG
Feb 4 '17 at 12:01
|
show 5 more comments
helpful link, thanks
– Kate Geld
Oct 23 '15 at 14:03
2
This answer is a life-saver dude!!! I am so happy I have stumbled upon it!!! So many thanks!!!
– Soberman
Feb 16 '16 at 19:03
4
Why does this work? And why does this not work out of the box in XCode?
– yurgis
Nov 8 '16 at 0:50
3
These line are worth gold!!! Thanks very much. Helped me solving endless Mach-O linker errors in a project with unit-test, ui-test and different deployment targets.
– Darkglow
Jan 24 '17 at 11:12
2
I had to do this with a brand new project created with XCode 8.2.
– MdaG
Feb 4 '17 at 12:01
helpful link, thanks
– Kate Geld
Oct 23 '15 at 14:03
helpful link, thanks
– Kate Geld
Oct 23 '15 at 14:03
2
2
This answer is a life-saver dude!!! I am so happy I have stumbled upon it!!! So many thanks!!!
– Soberman
Feb 16 '16 at 19:03
This answer is a life-saver dude!!! I am so happy I have stumbled upon it!!! So many thanks!!!
– Soberman
Feb 16 '16 at 19:03
4
4
Why does this work? And why does this not work out of the box in XCode?
– yurgis
Nov 8 '16 at 0:50
Why does this work? And why does this not work out of the box in XCode?
– yurgis
Nov 8 '16 at 0:50
3
3
These line are worth gold!!! Thanks very much. Helped me solving endless Mach-O linker errors in a project with unit-test, ui-test and different deployment targets.
– Darkglow
Jan 24 '17 at 11:12
These line are worth gold!!! Thanks very much. Helped me solving endless Mach-O linker errors in a project with unit-test, ui-test and different deployment targets.
– Darkglow
Jan 24 '17 at 11:12
2
2
I had to do this with a brand new project created with XCode 8.2.
– MdaG
Feb 4 '17 at 12:01
I had to do this with a brand new project created with XCode 8.2.
– MdaG
Feb 4 '17 at 12:01
|
show 5 more comments
At least as of Xcode 7.3 test targets let you select a "Host Application". In the Test target (but not presently the UI Test target) this automatically populates the "Test Host" build setting, but not the "Bundle Loader", which can lead to classes not being found.
Considering this, if you set your test targets' "Bundle Loader" Build Setting to $(TEST_HOST)
, it will always contain the right value even if you change the Host Application.
This is effectively the opposite of the advice given in the link @yuwen-yan posted, and should amount to less work.
2
I found$(TEST_HOST)
to be the default configuration, however still one of my pods isn't found.
– Lars Blumberg
Jun 8 '16 at 9:27
1
In Xcode9.2, its now under Test target > Build settings > Testing > Test host. Adding $(TEST_HOST) still works. However, I also did update my cocoapods.
– quik_silv
Aug 2 '18 at 21:40
add a comment |
At least as of Xcode 7.3 test targets let you select a "Host Application". In the Test target (but not presently the UI Test target) this automatically populates the "Test Host" build setting, but not the "Bundle Loader", which can lead to classes not being found.
Considering this, if you set your test targets' "Bundle Loader" Build Setting to $(TEST_HOST)
, it will always contain the right value even if you change the Host Application.
This is effectively the opposite of the advice given in the link @yuwen-yan posted, and should amount to less work.
2
I found$(TEST_HOST)
to be the default configuration, however still one of my pods isn't found.
– Lars Blumberg
Jun 8 '16 at 9:27
1
In Xcode9.2, its now under Test target > Build settings > Testing > Test host. Adding $(TEST_HOST) still works. However, I also did update my cocoapods.
– quik_silv
Aug 2 '18 at 21:40
add a comment |
At least as of Xcode 7.3 test targets let you select a "Host Application". In the Test target (but not presently the UI Test target) this automatically populates the "Test Host" build setting, but not the "Bundle Loader", which can lead to classes not being found.
Considering this, if you set your test targets' "Bundle Loader" Build Setting to $(TEST_HOST)
, it will always contain the right value even if you change the Host Application.
This is effectively the opposite of the advice given in the link @yuwen-yan posted, and should amount to less work.
At least as of Xcode 7.3 test targets let you select a "Host Application". In the Test target (but not presently the UI Test target) this automatically populates the "Test Host" build setting, but not the "Bundle Loader", which can lead to classes not being found.
Considering this, if you set your test targets' "Bundle Loader" Build Setting to $(TEST_HOST)
, it will always contain the right value even if you change the Host Application.
This is effectively the opposite of the advice given in the link @yuwen-yan posted, and should amount to less work.
edited Apr 28 '16 at 15:18
answered Apr 27 '16 at 18:25
Ben ThielkerBen Thielker
3,01931417
3,01931417
2
I found$(TEST_HOST)
to be the default configuration, however still one of my pods isn't found.
– Lars Blumberg
Jun 8 '16 at 9:27
1
In Xcode9.2, its now under Test target > Build settings > Testing > Test host. Adding $(TEST_HOST) still works. However, I also did update my cocoapods.
– quik_silv
Aug 2 '18 at 21:40
add a comment |
2
I found$(TEST_HOST)
to be the default configuration, however still one of my pods isn't found.
– Lars Blumberg
Jun 8 '16 at 9:27
1
In Xcode9.2, its now under Test target > Build settings > Testing > Test host. Adding $(TEST_HOST) still works. However, I also did update my cocoapods.
– quik_silv
Aug 2 '18 at 21:40
2
2
I found
$(TEST_HOST)
to be the default configuration, however still one of my pods isn't found.– Lars Blumberg
Jun 8 '16 at 9:27
I found
$(TEST_HOST)
to be the default configuration, however still one of my pods isn't found.– Lars Blumberg
Jun 8 '16 at 9:27
1
1
In Xcode9.2, its now under Test target > Build settings > Testing > Test host. Adding $(TEST_HOST) still works. However, I also did update my cocoapods.
– quik_silv
Aug 2 '18 at 21:40
In Xcode9.2, its now under Test target > Build settings > Testing > Test host. Adding $(TEST_HOST) still works. However, I also did update my cocoapods.
– quik_silv
Aug 2 '18 at 21:40
add a comment |
Experienced the same issue.
What fixed it for me was setting enable modules (c and objective-c)
to YES in the Testing target Build Settings
.
add a comment |
Experienced the same issue.
What fixed it for me was setting enable modules (c and objective-c)
to YES in the Testing target Build Settings
.
add a comment |
Experienced the same issue.
What fixed it for me was setting enable modules (c and objective-c)
to YES in the Testing target Build Settings
.
Experienced the same issue.
What fixed it for me was setting enable modules (c and objective-c)
to YES in the Testing target Build Settings
.
answered Mar 24 '16 at 11:25
RazRaz
1,9231740
1,9231740
add a comment |
add a comment |
So here is what worked for me...
override func setUp() {
super.setUp()
let promise = expectation(description: "App has finished running")
DispatchQueue.global(qos: .background).async{
// Wait on the background thread
sleep(4)
DispatchQueue.main.async {
// Fullfill the promise in the main thread
promise.fulfill()
}
}
// Initialize the storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
// Get the view controller
sut = storyboard.instantiateViewController(withIdentifier: String(describing: ViewController.self)) as? ViewController
_ = sut.view
waitForExpectations(timeout: 5) { (_) in
// Finish set up after the app is done running its code
}
}// End setUp() Method
add a comment |
So here is what worked for me...
override func setUp() {
super.setUp()
let promise = expectation(description: "App has finished running")
DispatchQueue.global(qos: .background).async{
// Wait on the background thread
sleep(4)
DispatchQueue.main.async {
// Fullfill the promise in the main thread
promise.fulfill()
}
}
// Initialize the storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
// Get the view controller
sut = storyboard.instantiateViewController(withIdentifier: String(describing: ViewController.self)) as? ViewController
_ = sut.view
waitForExpectations(timeout: 5) { (_) in
// Finish set up after the app is done running its code
}
}// End setUp() Method
add a comment |
So here is what worked for me...
override func setUp() {
super.setUp()
let promise = expectation(description: "App has finished running")
DispatchQueue.global(qos: .background).async{
// Wait on the background thread
sleep(4)
DispatchQueue.main.async {
// Fullfill the promise in the main thread
promise.fulfill()
}
}
// Initialize the storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
// Get the view controller
sut = storyboard.instantiateViewController(withIdentifier: String(describing: ViewController.self)) as? ViewController
_ = sut.view
waitForExpectations(timeout: 5) { (_) in
// Finish set up after the app is done running its code
}
}// End setUp() Method
So here is what worked for me...
override func setUp() {
super.setUp()
let promise = expectation(description: "App has finished running")
DispatchQueue.global(qos: .background).async{
// Wait on the background thread
sleep(4)
DispatchQueue.main.async {
// Fullfill the promise in the main thread
promise.fulfill()
}
}
// Initialize the storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
// Get the view controller
sut = storyboard.instantiateViewController(withIdentifier: String(describing: ViewController.self)) as? ViewController
_ = sut.view
waitForExpectations(timeout: 5) { (_) in
// Finish set up after the app is done running its code
}
}// End setUp() Method
answered Nov 21 '18 at 23:26
Deo KaluleDeo Kalule
111
111
add a comment |
add a comment |
Experienced the same linker error after adding test target to old project which was created 2 or 3 XCode versions ago. Furthermore, project has various xcodeproject/target/bundle names. All possible renames, cleanings, Build settings
, Build phases
, Scheme
manipulations did not worked for me.
What did actually worked after a long struggle is recreating the project along with all targets from scratch in latest Xcode version. It finally links! And in this case you don't even need to manually modify Search paths
, Bundle loader
, Xcode will do it for you.
add a comment |
Experienced the same linker error after adding test target to old project which was created 2 or 3 XCode versions ago. Furthermore, project has various xcodeproject/target/bundle names. All possible renames, cleanings, Build settings
, Build phases
, Scheme
manipulations did not worked for me.
What did actually worked after a long struggle is recreating the project along with all targets from scratch in latest Xcode version. It finally links! And in this case you don't even need to manually modify Search paths
, Bundle loader
, Xcode will do it for you.
add a comment |
Experienced the same linker error after adding test target to old project which was created 2 or 3 XCode versions ago. Furthermore, project has various xcodeproject/target/bundle names. All possible renames, cleanings, Build settings
, Build phases
, Scheme
manipulations did not worked for me.
What did actually worked after a long struggle is recreating the project along with all targets from scratch in latest Xcode version. It finally links! And in this case you don't even need to manually modify Search paths
, Bundle loader
, Xcode will do it for you.
Experienced the same linker error after adding test target to old project which was created 2 or 3 XCode versions ago. Furthermore, project has various xcodeproject/target/bundle names. All possible renames, cleanings, Build settings
, Build phases
, Scheme
manipulations did not worked for me.
What did actually worked after a long struggle is recreating the project along with all targets from scratch in latest Xcode version. It finally links! And in this case you don't even need to manually modify Search paths
, Bundle loader
, Xcode will do it for you.
answered Jun 29 '18 at 9:14
Alexander StepanishinAlexander Stepanishin
14818
14818
add a comment |
add a comment |
This error may be the result of having wrong test target type, namely ui test target.
UI test targets can't use the internals of the main target, not even with @testable
imports. Unit test targets OTOH can use the internals.
See more details in this answer.
(I believe this has changed in some XCode version which causes confusion. Typical way is just to include a huge bunch of files from the original target in the ui test target. A proper way is to design UI tests in such a way that they don't need or use much code from the main target.)
add a comment |
This error may be the result of having wrong test target type, namely ui test target.
UI test targets can't use the internals of the main target, not even with @testable
imports. Unit test targets OTOH can use the internals.
See more details in this answer.
(I believe this has changed in some XCode version which causes confusion. Typical way is just to include a huge bunch of files from the original target in the ui test target. A proper way is to design UI tests in such a way that they don't need or use much code from the main target.)
add a comment |
This error may be the result of having wrong test target type, namely ui test target.
UI test targets can't use the internals of the main target, not even with @testable
imports. Unit test targets OTOH can use the internals.
See more details in this answer.
(I believe this has changed in some XCode version which causes confusion. Typical way is just to include a huge bunch of files from the original target in the ui test target. A proper way is to design UI tests in such a way that they don't need or use much code from the main target.)
This error may be the result of having wrong test target type, namely ui test target.
UI test targets can't use the internals of the main target, not even with @testable
imports. Unit test targets OTOH can use the internals.
See more details in this answer.
(I believe this has changed in some XCode version which causes confusion. Typical way is just to include a huge bunch of files from the original target in the ui test target. A proper way is to design UI tests in such a way that they don't need or use much code from the main target.)
answered Oct 17 '18 at 5:27
Peter LambergPeter Lamberg
3,79513350
3,79513350
add a comment |
add a comment |
Below are the steps that I performed to fix the issue while trying to add unit test target in Xcode 9:
- Go to 'Manage Schemes'.
- Click on '+' button at the bottom.
- Select the newly added Target and select 'OK'.
- Make sure 'Shared' option is selected for the newly added target.
add a comment |
Below are the steps that I performed to fix the issue while trying to add unit test target in Xcode 9:
- Go to 'Manage Schemes'.
- Click on '+' button at the bottom.
- Select the newly added Target and select 'OK'.
- Make sure 'Shared' option is selected for the newly added target.
add a comment |
Below are the steps that I performed to fix the issue while trying to add unit test target in Xcode 9:
- Go to 'Manage Schemes'.
- Click on '+' button at the bottom.
- Select the newly added Target and select 'OK'.
- Make sure 'Shared' option is selected for the newly added target.
Below are the steps that I performed to fix the issue while trying to add unit test target in Xcode 9:
- Go to 'Manage Schemes'.
- Click on '+' button at the bottom.
- Select the newly added Target and select 'OK'.
- Make sure 'Shared' option is selected for the newly added target.
answered Jan 2 '18 at 17:42
NishNish
1063
1063
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f30935640%2fxcode-unittest-build-failed-with-error-undefined-symbols-for-architecture-x86-6%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Where is the
MCStore
class implemented?– Droppy
Jun 19 '15 at 10:30
it's implemented in my application target.
– Yuwen Yan
Jun 19 '15 at 10:31
And the test target includes that implementation file?
– Droppy
Jun 19 '15 at 10:32
No, I have added my application target to the unittest target dependencies
– Yuwen Yan
Jun 19 '15 at 10:36