No visible #interface for 'RCTBundleURLProvider' - objective-c

I am adding a method to AppDelegate.m by following the react native 0.68 codepush doc which does not provide detail for the change. Here is the AppDelegate.m after change:
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
#import <CodePush/CodePush.h> /* for rn codepush */
#import <React/RCTBundleURLProvider.h> /* for rn codepush */
#interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
#property (nonatomic, strong) UIWindow *window;
#end
#implementation AppDelegate
/* for rn code push */
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil]; /*this line throw error */
#else
return [CodePush bundleURL];
#endif
}
#end
Now the error is No visible #interface for 'RCTBundleURLProvider' declares the selector 'jsBundleURLForBundleRoot:fallbackResource:'.

Might be late here :)
After some research, I found out that jsBundleURLForBundleRoot:fallbackResource: no longer exists on RCTBundleURLProvider.
Here's the Fix:
Replace
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index" fallbackResource:nil];
with
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index"];
Re-Build the app and you are good to go.

Related

Receiver type X for for instance message is a forward declaration but header for class X is imported

I am trying to fix this compiler error:
Receiver type X for for instance message is a forward declaration.
The App is a Universal iOS app with a storyboard. This problem involves three VC Classes.
From my RootTableViewController, the app can segue to either InfoScaledViewController or SubListViewController.
Compilation fails because of the following error.
RootTableViewController.m:309:10: Receiver type 'InfoScaledViewController' for instance message is a forward declaration
There is no corresponding error a few lines above it, where identical procedure is done with SubListViewController.
These two lines are:
SubListViewController *destCntrlr =
(SubListViewController *)segue.destinationViewController;
and
InfoScaledViewController *destCntrlr =
(InfoScaledViewController *)segue.destinationViewController ;
If I comment out the line that causes this compilation error and set a breakpoint at that position, you can see from the following screenshot, why I am puzzled by the error.
As you can see, I have used #import "InfoScaledViewController.h" in RootTableViewController.m and #class InfoScaledViewController
in RootTableViewController.h
I have read many answers given to address this error. None of the have helped.
File: InfoScaledViewController.h
#import <UIKit/UIKit.h>
#import "BNRDynamicTypeManagedLabel.h"
...
#interface InfoScaledViewController : UIViewController <UIAlertViewDelegate> {
BOOL pushedForImport;
...
}
#property (nonatomic, assign) BOOL pushedForImport;
...
#end //InfoScaledViewController.h
File: InfoScaledViewController.m
#import "InfoScaledViewController.h"
...
#implementation InfoScaledViewController
#synthesize pushedForImport;
#end // InfoScaledViewController.m
File: SubListViewController.h
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#interface SubListViewController : CoreDataTVC < UITableViewDelegate,UITableViewDataSource,UIAlertViewDelegate, AddRecipeDelegate,EditRecipeDelegate,UISearchBarDelegate,UITextFieldDelegate> {
//...
BOOL isNewPush;
}
//...
#property (nonatomic,assign) BOOL isNewPush;
//...
#end //SubListViewController.h
File: SubListViewController.m
#import "SubListViewController.h"
//...
#implementation SubListViewController
//...
#synthesize isNewPush;
#end
File: RootTableViewController.h
#import <UIKit/UIKit.h>
...
// #import "InfoScaledViewController.h"
#class InfoScaledViewController;
#class SubListViewController;
//...
#interface RootTableViewController : CoreDataTVC
< NameViewDelegate,UIAlertViewDelegate, UITableViewDataSource, UITableViewDelegate >
{
//...
SubListViewController *subListViewController;
InfoScaledViewController* infoViewController;
//...
}
#property (nonatomic, strong) SubListViewController *subListViewController;
#property (nonatomic, strong) InfoScaledViewController * infoViewController;
...
#end
File: RootTableViewController.m
#import "RootTableViewController.h"
//...
#import "SubListViewController.h"
#import "InfoScaledViewController.h"
//...
#implementation RootTableViewController
#synthesize subListViewController = _subListViewController;
#synthesize infoViewController = _infoViewController;
//...
#end // RootTableViewController.m
THE PLACE in RootTableViewController.m WHERE ERROR OCCURS IS BELOW
Note: Xcode "recognizes" both SubListViewController and InfoScaledViewController Classes, giving both names the same color.
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.identifier isEqualToString:#"SLVC"]) {
SubListViewController *destCntrlr
= (SubListViewController *)segue.destinationViewController;
[destCntrlr setIsNewPush:YES]; // NO ERROR HERE
...
}else if ([segue.identifier isEqualToString:#"INFO"]){
InfoScaledViewController *destCntrlr
= (InfoScaledViewController *)segue.destinationViewController ;
[destCntrlr setPushedForImport:(sender == nil) ? YES : NO]; // ERROR HERE breakpoint is here
...
}
else if ([segue.identifier isEqualToString:#"ADDCATEGORY"]){
...
}
}

iOS5, StoryBoards, ARC: Weird categories issue

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.

#synthesize hides file header?

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.

Xcode Build errors (newbie)

Here's my code:
(from SQLiteDB.h)
#import <sqlite3.h>
#interface SQLiteDB : NSObject {
NSString *dbPath;
int databaseKey;
sqlite3 *db;
}
//#property (nonatomic, copy) NSString *db;
#property (nonatomic, copy) NSString *dbPath;
#property (nonatomic) sqlite3 *db;
#property (nonatomic) int databaseKey;
#end
===============
(from SQLiteDB.m)
#import "SQLiteDB.h"
#implementation SQLiteDB
#synthesize db, dbPath, databaseKey;
#end
===============
(from SampleAppDelegate.m)
#import "ReaderSampleAppDelegate.h"
#import "ReaderSampleViewController.h"
#implementation ReaderSampleAppDelegate
#synthesize window;
#synthesize viewController;
#pragma mark -
#pragma mark Application lifecycle
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
// create the d/b or get the connection value
SQLiteDB *dbInstance = [[SQLiteDB alloc] init]; // Error here <---------
}
==================
Error is: SQLiteDB undeclared.
I thought I did declare it in SQLiteDB.h? How do I fix this?
use
#import "SQLiteDB.h"
in SampleAppDelegate.m
In SampleAppDelegate.m include the following line:
#import "SQLiteDB.h"
You need:
#import "SQLiteDB.h" in SampleAppDelegate.m or .h
You need to #import SQLiteDB.h into SampleAppDelegate.m
You probably need to #import "SQLiteDB.h" in SampleAppDelegate.m

Problem compiling a simple test project for the iPhone

I am new to iphone development. I have this code in the delegate.h section:
#import <UIKit/UIKit.h>
#import <objc/Object.h>
#class Learning1ViewController;
#interface Greeter: NSObject<UIApplicationDelegate>
{
}
-(void)greet;
#end
#include <stdio.h>
#implementation Greeter
-(void) greet
{
printf ("Hello, World!\n");
}
#include <stdlib.h>
int main(void)
{
id myGreeter;
myGreeter=[Greeter new];
[myGreeter greet];
[myGreeter free];
return EXIT_SUCCESS;
}
#end
#interface Learning1AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
Learning1ViewController *viewController;
}
#property (nonatomic, retain) IBOutlet UIWindow *window;
#property (nonatomic, retain) IBOutlet Learning1ViewController *viewController;
#end
When i compile i get this error:
ld: duplicate symbol _main in /Users/ianbennett/Desktop/iphone development/Learning1/build/Learning1.build/Debug-iphonesimulator/Learning1.build/Objects-normal/i386/Learning1AppDelegate.o and /Users/ianbennett/Desktop/iphone development/Learning1/build/Learning1.build/Debug-iphonesimulator/Learning1.build/Objects-normal/i386/main.o
command/Developer/platforms/iphoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
I have seen that other people have had similar errors and that it might be to do with my library but im not really sure how to fix it.
You have defined the main() function twice (looks like it's defined in Learning1AppDelegate.m and main.m
Thanks for the error message
You have defined the same function main in 2 places
The files are
main
Learning1AppDelegate
You can only define a function in one place - so you have to choose