I have added latest 6.9.2 google admob to my project ,and when i add admob codes i got lots of errors bcoz i didnt add any framework fro that.But after that am getting 1 error
please check error
Ld /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Products/Debug-iphonesimulator/iFix.app/iFix normal x86_64
cd /Users/apple/Documents/myApp/iFix
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Products/Debug-iphonesimulator -L/Users/apple/Documents/myApp/iFix/GoogleMobileAdsSdkiOS-6.9.2/Add-ons/GoogleAnalyticsServicesiOS_3.06 -L/Users/apple/Documents/myApp/iFix/GoogleMobileAdsSdkiOS-6.9.2 -F/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Products/Debug-iphonesimulator -filelist /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/iFix.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -lsqlite3 -framework CoreTelephony -framework AudioToolbox -lz -lGoogleAnalyticsServices -framework CoreData -framework SystemConfiguration -framework AdSupport -framework StoreKit -framework MessageUI -lAdIdAccess -lGoogleAdMobAds -framework QuartzCore -framework CoreGraphics -framework Accelerate -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/iFix_dependency_info.dat -o /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Products/Debug-iphonesimulator/iFix.app/iFix
duplicate symbol _OBJC_IVAR_$_RootViewController._delegate in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-7D747D9B193AB571.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-484D37809EE9EA65.o
duplicate symbol _OBJC_IVAR_$_RootViewController._tableView in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-7D747D9B193AB571.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-484D37809EE9EA65.o
duplicate symbol _OBJC_IVAR_$_RootViewController._items in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-7D747D9B193AB571.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-484D37809EE9EA65.o
duplicate symbol _OBJC_CLASS_$_RootViewController in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-7D747D9B193AB571.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-484D37809EE9EA65.o
duplicate symbol _OBJC_METACLASS_$_RootViewController in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-7D747D9B193AB571.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-484D37809EE9EA65.o
duplicate symbol _OBJC_CLASS_$_ImageViewController in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/ImageViewController-4F03FFF23E5AE975.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/ImageViewController-842B460CB8ABB481.o
duplicate symbol _OBJC_METACLASS_$_ImageViewController in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/ImageViewController-4F03FFF23E5AE975.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/ImageViewController-842B460CB8ABB481.o
duplicate symbol _OBJC_IVAR_$_CategoryViewController._category in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-85440B24E1A926F.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-4147041320096859.o
duplicate symbol _OBJC_IVAR_$_CategoryViewController._delegate in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-85440B24E1A926F.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-4147041320096859.o
duplicate symbol _OBJC_IVAR_$_CategoryViewController._tableView in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-85440B24E1A926F.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-4147041320096859.o
duplicate symbol _OBJC_IVAR_$_CategoryViewController._items in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-85440B24E1A926F.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-4147041320096859.o
duplicate symbol _OBJC_CLASS_$_CategoryViewController in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-85440B24E1A926F.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-4147041320096859.o
duplicate symbol _OBJC_METACLASS_$_CategoryViewController in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-85440B24E1A926F.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-4147041320096859.o
duplicate symbol _main in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/main-C7855F1C6FD2F976.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/main-FCACA536EA23C482.o
duplicate symbol _OBJC_METACLASS_$_NavController in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/NavController-13F0601C84D2856E.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/NavController-B8881D70D2C31978.o
duplicate symbol _OBJC_CLASS_$_NavController in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/NavController-13F0601C84D2856E.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/NavController-B8881D70D2C31978.o
duplicate symbol _main in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/main-C7855F1C6FD2F976.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/main-BA62C00639C12D74.o
duplicate symbol _OBJC_IVAR_$_AppDelegate._window in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-2A03492D855AA76D.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-1751825DEB2A726D.o
duplicate symbol _OBJC_IVAR_$_AppDelegate._navController in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-2A03492D855AA76D.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-1751825DEB2A726D.o
duplicate symbol _OBJC_IVAR_$_AppDelegate._viewController in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-2A03492D855AA76D.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-1751825DEB2A726D.o
duplicate symbol _OBJC_IVAR_$_AppDelegate._images in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-2A03492D855AA76D.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-1751825DEB2A726D.o
duplicate symbol _OBJC_METACLASS_$_AppDelegate in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-2A03492D855AA76D.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-1751825DEB2A726D.o
duplicate symbol _OBJC_CLASS_$_AppDelegate in:
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-2A03492D855AA76D.o
/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-1751825DEB2A726D.o
ld: 23 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please check my frameworks
And the code am using for admob is
enter code here
- (GADRequest *)createRequest {
GADRequest *request = [GADRequest request];
// Make the request for a test ad. Put in an identifier for the simulator as
// well as any devices you want to receive test ads.
request.testDevices =
[NSArray arrayWithObjects:
// TODO: Add your device/simulator test identifiers here. They are
// printed to the console when the app is launched.
nil];
return request;
}
#pragma mark GADBannerViewDelegate impl
// We've received an ad successfully.
- (void)adViewDidReceiveAd:(GADBannerView *)adView {
NSLog(#"Received ad successfully");
}
- (void)adView:(GADBannerView *)view
didFailToReceiveAdWithError:(GADRequestError *)error {
NSLog(#"Failed to receive ad with error: %#", [error localizedFailureReason]);
}
-(void)viewDidAppear:(BOOL)animated{
if([GMMConnectivity hasConnectivity]){
// [self loadAds];
NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval: 15.0 target: self
selector: #selector(callAfterSixtySecond:) userInfo: nil repeats: YES];
}
}
-(void) callAfterSixtySecond:(NSTimer*) t
{
if([GMMConnectivity hasConnectivity]){
[self.adBanner removeFromSuperview];
[self loadAdmob];
}
}
-(void)loadAdmob{
CGPoint origin;
if(IS_RETINA){
if([[UIScreen mainScreen] bounds].size.height >500){
// NSLog(#"5");
origin = CGPointMake(0.0,
568-
CGSizeFromGADAdSize(kGADAdSizeSmartBannerPortrait).height);
}else{
// NSLog(#"4");
origin = CGPointMake(0.0,
(480)-
CGSizeFromGADAdSize(kGADAdSizeSmartBannerPortrait).height);
}
}else{
// NSLog(#"3");
origin = CGPointMake(0.0,
(460)-
CGSizeFromGADAdSize(kGADAdSizeSmartBannerPortrait).height);
}
// Use predefined GADAdSize constants to define the GADBannerView.
self.adBanner = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait
origin:origin]
;
// Note: Edit SampleConstants.h to provide a definition for kSampleAdUnitID
// before compiling.
self.adBanner.adUnitID = MY_BANNER_UNIT_ID;
self.adBanner.delegate = self;
[self.adBanner setRootViewController:self];
[self.view addSubview:self.adBanner];
self.adBanner.center =
CGPointMake(self.view.center.x, self.adBanner.center.y);
[self.adBanner loadRequest:[self createRequest]];
[self.view addSubview:adBanner_];
}
I had a similar issue when I added Google Analytics SDK. You should remove the example code in the AdMob SDK package, and build again. Let me know if it solves your problem.
i added -ObjC i other linker flags and its working now
Related
I am trying to run the following test from Chapter 16: Testing with RxTest of Raywenderlich RxSwift book:
import XCTest
import RxSwift
import RxTest
#testable import Testing
class TestingViewModel : XCTestCase {
var viewModel: ViewModel!
var scheduler: ConcurrentDispatchQueueScheduler!
override func setUp() {
super.setUp()
viewModel = ViewModel()
scheduler = ConcurrentDispatchQueueScheduler(qos: .default)
}
func testColorNameIsRayWenderlichGreenWhenHexStringIs006636() {
// 1
let colorNameObservable = viewModel.colorName.asObservable().subscribeOn(scheduler)
// 2
viewModel.hexString.value = "#006636"
// 3
XCTAssertEqual("rayWenderlichGreen", try! colorNameObservable.toBlocking().first()!)
}
}
But I get this error on the simulator:
Undefined symbols for architecture x86_64:
"type metadata for RxCocoa.DriverSharingStrategy", referenced from:
TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o
"protocol witness table for RxCocoa.DriverSharingStrategy : RxCocoa.SharingStrategyProtocol in RxCocoa", referenced from:
TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o
"RxCocoa.SharedSequence.asObservable() -> RxSwift.Observable", referenced from:
TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And This one on iPhone 6s:
Undefined symbols for architecture arm64:
"type metadata for RxCocoa.DriverSharingStrategy", referenced from:
TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o
"protocol witness table for RxCocoa.DriverSharingStrategy : RxCocoa.SharingStrategyProtocol in RxCocoa", referenced from:
TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o
"RxCocoa.SharedSequence.asObservable() -> RxSwift.Observable", referenced from:
TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Unfortunately, there is no support for this issue in Raywenderlich's forums.
After a lot of searches, As somebody suggests here for another similar issue I found that this error will be solved by importing RxCocoa.
I have following code in Swift in A.swift file:
/// **A.swift**
protocol Johnkui: class {
var name: TruncatedView? { get set }
}
/// typealias TruncatedView = String
class TruncatedView: UIView {
}
extension UIView {
private struct TruncatedViewKey {
static var navigationViewKey = "navigationViewKey"
}
var name: TruncatedView? {
set {
objc_setAssociatedObject(self, &TruncatedViewKey.navigationViewKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_ASSIGN)
}
get {
return objc_getAssociatedObject(self, &TruncatedViewKey.navigationViewKey) as? TruncatedView
}
}
}
and B.swift file has following code:
/// B.swift
class JJ: UIView, Johnkui {
}
When compiling these two files, a linking error was reported:
Undefined symbols for architecture x86_64:
"__TFE9SwiftTestCSo6UIViewm4nameGSqCS_13TruncatedView_", referenced from:
__TTWC9SwiftTest2JJS_7JohnkuiS_FS1_m4nameGSqCS_13TruncatedView_ in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
However, when combining these two files into one, the error is gone, and I cannot find out the reason for this result, what's your explanation?
I wish to unit test my Array extension.
extension Array {
func itemPassingTest(test: (T) -> Bool) -> T? {
for item in self {
if test(item) {
return item
}
}
return nil
}
}
In my unit test target, I have
import XCTest
import JLTExample
class JLTExampleTests: XCTestCase {
func testExtensionArray() {
let target = [ ["a" : 1], ["a" : 2], ["a" : 3] ]
let actual = target.itemPassingTest { $0["a"] == 2 }
XCTAssertNotNil(actual)
}
}
When building I get the error
Undefined symbols for architecture i386:
"__TFSa15itemPassingTestU__fGSaQ__FFQSbGSqQ_", referenced from:
__TFC17JLTExampleTests17JLTExampleTests18testExtensionArrayfS0_FT_T_ in JLTExampleTests.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My guess is I'm importing my extension, but I don't know how to import an extension. I was hoping that my extension would have been imported with the rest of my code in import JLTExample.
I am trying to play a sound when a uibutton is pressed..
this is my code
-(IBAction) playSound:(id)sender{
NSString *path = [[NSBundle mainBundle] pathForResource:#"SQUEEK" ofType:#"wav"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate=self;
[theAudio play];
}
this is the output when the button is pressed
2012-07-13 16:41:02.803 squeek[1475:12103] Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn: dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-13 16:41:02.811 squeek[1475:12103] Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn: dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-13 16:41:03.389 squeek[1475:12103] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn: dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-13 16:41:03.396 squeek[1475:12103] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn: dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-13 16:41:03.409 squeek[1475:12103] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn: dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-13 16:41:03.417 squeek[1475:12103] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn: dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-13 16:41:03.431 squeek[1475:12103] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn: dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-07-13 16:41:03.440 squeek[1475:12103] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn: dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
the IBAction is hooked up to the UIButton with the touch up inside feature, also I have added the avfoundation framework.
any help would be greatly appreciated.
#HurkNburkS
You just need a little more search in Stack Overflow before asking the same question. Whatever check the below question and try the solutions given in that.
Sound not playing with AVAudioPlayer
Supported Audio file formats in iPhone
Check out your audio format could be a problem or your "theAudio" instance should be deallocated.
Try like this and print your error...
NSError *error;
audioPlayer = [[AVAudioPlayer alloc]
initWithContentsOfURL:url
error:&error];
if (error)
{
NSLog(#"Error in audioPlayer: %#",
[error localizedDescription]);
} else {
audioPlayer.delegate = self;
[audioPlayer prepareToPlay];
}
I wrote a simple function, passes the compiler but not the linker.
Any idea why?
- (BOOL) connectedToWifi
{
CFArrayRef myArray = CNCopySupportedInterfaces();
// Get the dictionary containing the captive network infomation
CFDictionaryRef captiveNtwrkDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
NSLog(#"Information of the network we're connected to: %#", captiveNtwrkDict);
NSDictionary *dict = (__bridge NSDictionary*) captiveNtwrkDict;
NSString* ssid = [dict objectForKey:#"SSID"];
if ([ssid rangeOfString:#"WXYZ"].location == NSNotFound || ssid == NULL)
{
return false;
}
else
{
return true;
}
}
This is the error I get:
Undefined symbols for architecture i386:
"_CNCopySupportedInterfaces", referenced from:
-[miApp_funcs connectedToWifi] in miApp_funcs.o
"_CNCopyCurrentNetworkInfo", referenced from:
-[miApp_funcs connectedToWifi] in miApp_funcs.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Following are steps-
1) Click project in Navigator area
2) Select 'TARGETS' tab
3) Click on 'Build Phases'
4) Select 'Link Binary With Libraries'
5) Then you can see '+' button at the bottom in the area.
You can now add the SystemConfiguration framework that you want.
#import <SystemConfiguration/SystemConfiguration.h>
You have to link to, and #import <SystemConfiguration/SystemConfiguration.h>, to have access to the Captive Network (CN) classes and functions.