I am in the process of creating an AR based location iphone app using https://github.com/markrickert/iPhone-AR-Toolkit
I have got these errors and do not know how to fix it. Please will someone help me. With a walkthrough and correct code
Link for image http://i60.tinypic.com/2i9p8c0.png
Seems to be trivial but just check whether you have imported the .h File??
#import "ARKit.h"
"Use of undeclared identifier _arViewController". To fix that simply add a property ARViewController *arViewController; to your #interface.
#interface ScanmarksViewController() {
ARViewController *_arViewController;
}
#end
or
#interface ScanmarksViewController()
#property (strong, nonatomic) ARViewController *arViewController;
#end
Whichever you prefer.
Related
I have a project where my simple png sequence animation code is in a swift file and my microphone detection code is in a .m file. I need to make it so my animation only plays when it detects the blow, but since I have moved my .m and .h files into the project the microphone detection message in the NSLog has stopped appearing. Any ideas on how I do this? which file I need to be working in to link the two etc?
Thanks in advance
You probably forgot to include it in your bridging header, hope this helps. If not you can contact me somehow I will try to help you.
#import "TestOBJC.h"
#implementation TestOBJC
- (void)test {
NSLog(#"test");
}
#end
#import <UIKit/UIKit.h>
#interface TestOBJC: NSObject
- (void)test;
#end
Bridging header:
#import "TestOBJC.h"
Swift:
let test = TestOBJC()
test.test()
Why is that when I follow Big Nerd Ranch 4th edition I always need to import #import <UIKit/UIKit.h> for any class that contains UIView, UIViewController, CG stuff but the code in the solutions is somehow working without it? Is there any Xcode compliance set up that can be made to make it work well with just #import <Foundation/Foundation.h> import?
For example, in 12th chapter, where they create TouchTracker app, their code is working just fine with:
#import <Foundation/Foundation.h>
#interface BNRLine : UIView
#property (nonatomic) CGPoint begin;
#property (nonatomic) CGPoint end;
#end
However, when I copy this code to my project it does not work without additional #import <UIKit/UIKit.h> line.
They probably use .pch imports. Basically it means that before every source file it will be imported and executed. This tutorial seems like a one you could see whats going on.
They may have additional imports inside a precompiled header file with a .pch extension. You can search for this file in their project.
In Xcode, if you command-click on the import statement you can bring up the detailed list of imports and that should answer any question you may have about what is being imported.
I found an Xcode project that uses something called an NSArrayController like this
#import <Cocoa/Cocoa.h>
#interface MyDocument : NSPersistentDocument {
IBOutlet NSArrayController *itemsArrayController;
NSArray *_sortDescriptors;
IBOutlet NSTableView *itemsTableView;
}
I was trying to use the project, which implements drag and drop, as a guide for an app I'm currently building. There's nothing in Xcode documentation when I option click on NSArrayController and I tried to create an NSArrayController property but received a warning that it doesn't exist. Was it deprecated? What has its functionality been replaced by?
NSArrayController is part of the AppKit.framework which is only available on the MacOS platform.
I know that Popover controllers are for use exclusively on iPad devices, but on below question there is a comment in which user has mentioned about category, code is as below,
UIPopoverController for iphone not working?
// UIPopoverController+iPhone.h file
#interface UIPopoverController (iPhone)
+ (BOOL)_popoversDisabled;
#end
// UIPopoverController+iPhone.m file
#implementation UIPopoverController (iPhone)
+ (BOOL)_popoversDisabled {
return NO;
}
#end
Is this right way?
Will Apple approve this?,
My iPad application is already done, now I am making it universal application, so instead of using any custom popover I want to add this category so that it will solve my issue and will reduce development efforts.
This is very hacky way, and you'll be taking a big risk putting it on the AppStore. Sure someone may have put a version in the store where they overlooked this, but it can break any moment and Apple may decide to remove his app.
Have you tested popovers on iPhone? Will you test in iOS7.1? Will it work exactly the same on iOS7.2 or iOS 7.3?
A far better solution would be to take an open source implementation of popovers and use that for iPhone (or both).
I have live app with with popover in iPhone.
Just You have to create interface for popover
NSObject+UIPopover_Iphone.h
#import <Foundation/Foundation.h>
#interface UIPopoverController (overrides)
+(BOOL)_popoversDisabled;
#end
NSObject+UIPopover_Iphone.m
#import "NSObject+UIPopover_Iphone.h"
#implementation UIPopoverController (overrides)
+(BOOL)_popoversDisabled
{
return NO;
}
#end
and now just import NSObject+UIPopover_Iphone.h in your Viewcontroller.h
Edit
For iOS 8 you can use
WYPopoverController.
I am doing a project using storyboard(first time using story board).In one of the viewcontroller there is a view with a mapview and a tableview containing prototype cells.I have included the mapkit framework and mapkit headers are imported in the corresponding viewcontroller.But i am getting this wierd error.I checked with many posts and all are pointing to the case where framework is not included.But i have included everything and still getting this issue.i cleaned and built but still this issue.any suggestions
*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named MKMapView'
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#interface CategoryDetailViewController : UIViewController<UITableViewDataSource,UITableViewDelegate,MKMapViewDelegate>
#property (weak, nonatomic) IBOutlet MKMapView *mapview;
#property (weak, nonatomic) IBOutlet UITableView *tableView;
#end
Make sure that the MapKit.framework is added to your project.
To verify/add the MapKit framework to your project:
Click on your project file in the left pane, then click on Build Phases.
Open up the Link Binary with Libraries
If you do not see the MapKit.framework, you'll want to add it by clicking on the plus sign.
In Swift using a newer version of Xcode, you only need to turn this capability on in the project settings and the error will go away.
It may sound simple but in the project folder of this app the mapkit files were copied,i removed it from this folder through finder and added the mapkit again.now its working.thanks for the comment by #Craig
I saw this problem when building a WatchKit extension for iOS. In addition to the linked binary I also had to add a file to Compiled Sources.