#import <Foundation/Foundation.h>
#import "Dropbox_Manager.h"
#interface FileSystemManager : NSObject {
NSFileManager *fileManager;
BOOL fileExisting;
BOOL contentIsEqual;
BOOL isWriteable;
Dropbox_Manager *dropBox_Manager; // Here Xcode shows the Error !!!!!
}
I don't get any other error in the project, but Xcode can't find the Type.
Replace
#import "Dropbox_Manager.h"
with
#class Dropbox_Manager;
Then add
#import "Dropbox_Manager.h"
to your FileSystemManager.m file
Related
I am a beginner in objective C and I am using the following code
I am using xcode6
// Car.h
#import <Foundation/Foundation.h>
#interface Car : NSObject {
NSString *simple_name; //This is private
#property int mssp; //Cant use #property Error illegal visibility specification
}
-(void) sayHi:(NSString*)msg ;
#end
Any suggestions on why I am getting this error ?
Move #property int mssp; out of the brackets:
// Car.h
#import <Foundation/Foundation.h>
#interface Car : NSObject {
NSString *simple_name; //This is private
}
#property int mssp;
-(void) sayHi:(NSString*)msg ;
#end
This question already has answers here:
Objective-C #import loop
(2 answers)
Closed 9 years ago.
#import <Foundation/Foundation.h>
#import "Asset.h"
#interface Person : NSObject{
int pin;
NSMutableArray* assets;
}
#property int pin;
-(void) addAsset: (Asset*) iasset; //producing error
#end
Trying to code the interface of a "Person" class that contains an array of "assets".
The line
-(void) addAsset: (Asset*) iasset;
produces an error. XCode says, "Expected a type". Can someone tell me where I'm going wrong? I can provide whatever other code is needed.
Asset.h :
#import <Foundation/Foundation.h>
#import "Person.h"
#interface Asset : NSObject{
NSString* label;
int value;
Person* holder;
}
#property int value;
-(void) setHolder: (Person*)iholder;
-(void) setLabel: (NSString*)iname;
#end
You have a circular dependency in your header files. You can fix it by removing #import "Person.h" in Asset.h and replacing it with #class Person;. This change will tell the compiler about the existence of the Person class without requiring the header to be imported.
Likewise, you could instead replace #import "Asset.h" in Person.h with #class Asset;.
You'll still want to include the correct headers from your implementation files.
I've created a file with sql methods and now this file is really large. I'd like to split it for best practice and implementation simplicity. So, categories.
I've created in xCode new objective-c categories file -> DBAccess+Generals.h (.m).
.h:
#import "DBAccess.h"
#interface DBAccess (Generals)
-(void)newMeth;
#end
.m
#import "DBAccess+Generals.h"
#import "DBAccess.h"
#implementation DBAccess (Generals)
-(void)newMeth
{
NSLog(#"New Meth");
}
#end
In DBAccess.h
#import <Foundation/Foundation.h>
#import <sqlite3.h>
#import "DBAccess+Generals.h"
#interface DBAccess : NSObject
{
NSString *databaseName;
}
#property(nonatomic,strong)NSString *databaseName;
DBAccess.m
#import "DBAccess.h"
#import "DBAccess+Generals.h"
#implementation DBAccess
#synthesize databaseName;
sqlite3* database=nil;
-(id)init
{
if ((self=[super init]))
{
//[self initializeDataBase];
databaseName=#"world_coins.db";
//firstVerDB=#"ac_ch_ver.1.0.db";
}
return self;
}
//Tones of methods
#end
Looks like the code is OK. Getting error "interface implementation not found for DBAccess". I've googled and stackoverflowed around, but the issues described, are not my case.
any help? Thank you in advance.
The problem is the cyclic import
#import "DBAccess+Generals.h" in DBAccess.h
#import "DBAccess.h" in DBAccess+Generals.h
If you remove the first one, the code compiles.
My project works fine on simulator but wouldn't build on real device after adding:
#synthesize extraView=_extraView;
It seems that this line somehow hides file header. Tried "Clean" - no change.
I've used #property and #synthesize many times before and haven't seen anything like this.
I'm planning to rewrite extraView handling but I'm asking just out of curiosity if someone has experienced similar error.
Platform:
XCode 4.0.1
4.2.1 Ipad
File header:
//
// MediaBook.h
// Dolphin
//
// Created by Handymood on 11-5-22.
// Copyright 2011 __Hanydmood__. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "SinglePage.h"
#import "LayerInfo.h"
#import "MediaBookXMLParser.h"
#import "GlobalSet.h"
#import "UIComponentBase.h"
#import "IndexPageInfo.h"
#import "IndexPage.h"
#import "TopBar.h"
#import "BottomBar.h"
#import "DolphinUIWebLayer.h"
#import "MediaBookBase.h"
#import "ColorUtil.h"
#import "DolphinUICategory.h"
#import "UICategoryUnit.h"
#import "ImageInfoBox.h"
#import "Gallery.h"
#import "Calendar.h"
#class SinglePage;
#class LayerInfo;
#class MediaBookXMLParser;
#class GlobalSet;
#class UIComponentBase;
#class IndexPageInfo;
#class IndexPage;
#class TopBar;
#class BottomBar;
#class DolphinUIWebLayer;
#class MediaBookBase;
#class ColorUtil;
#class DolphinUICategory;
#class UICategoryUnit;
#interface MediaBook : MediaBookBase <UIScrollViewDelegate>
{
UIImageLayer *backGroundImage;
UIView *bgView;
BottomBar *bottomBar;
DolphinUIWebLayer *webLayer;
DolphinUICategory *categoryLayer;
UIActivityIndicatorView *activityIndicator;
UIInterfaceOrientation preOrientation;
NSTimer *objQueMagTimer;
float previous_scroll_pos;
BOOL bar_status_hidden;
float top_bar_ori_y;
float bottom_bar_ori_y;
BOOL scroll_block_signal;
int screen_direction;//0:vertical 1:horizontal
BOOL webLayerOn;
BOOL categoryOn;
BOOL changingExtraView;
}
#property UIInterfaceOrientation preOrientation;
#property (nonatomic, retain) UIView *extraView;
-(void) initWithGlobalSet:(GlobalSet *) inGlobalSet;
-(void) initBook:(NSString *)configXmlAdd curOrientation:(UIInterfaceOrientation)interfaceOrientation;
-(void) initBookContent;
-(void) notificationSelector:(NSNotification *) notification;
-(void) statusBarAnimationTrigger;
-(void) layoutAdjustWithOrientation:(UIInterfaceOrientation)interfaceOrientation
orientaionType:(NSString *) inOrientationType;
-(void) closeCategoryLayer;
-(void) reset;
-(void) showExtraView:(NSString *)name;
-(void) hideExtraView;
#end
Screenshot of build errors:
I've used #property and #synthesize many times before and haven't seen any similar.
Adding following to interface declaration solved the problem:
UIView *_extraView;
Thanks to mja for the tip.
I'm trying to compile my Objective-C application but it fails saying "Unknown type name 'OpenGLView'". Now I know what this means but the weird thing is I'm convinced I'm importing it just fine.
#import <Foundation/Foundation.h>
#import "OpenGLView.h"
#import "Frame.h"
#import "Mesh2.h"
#import "Vector2.h"
#import "StaticRigidBody.h"
#import "DynamicRigidBody.h"
#interface PhysicsApplicationController : NSObject {
Frame* frame;
OpenGLView* view;
}
It fails on line 11 of this sample. You can see I import it on line 2. The thing which I can't get my head around though is the same import works completely fine in this segment.
#import <UIKit/UIKit.h>
#import "OpenGLView.h"
#interface PhysicsAppDelegate : UIResponder <UIApplicationDelegate> {
OpenGLView* _glView;
}
Both source files for the two segments are in the same directory. I have no idea what is going on.
[EDIT]
Content of OpenGLView.h
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#import "PhysicsApplicationController.h"
#interface OpenGLView : UIView {
CAEAGLLayer* _eaglLayer;
EAGLContext* _context;
GLuint _colorRenderBuffer;
GLuint _positionSlot;
GLuint _colorSlot;
PhysicsApplicationController* _physicsController;
}
typedef struct {
float position[3];
float color[4];
} Vertex;
- (void)renderFrame:(Frame*)frame;
- (void)drawObjectsInFrame:(Frame*)frame;
- (void)setupVBOsWithVertices:(Vertex*)vertices Indices:(GLubyte*)indices;
- (void)setPhysicsController:(PhysicsApplicationController*)controller;
#end