I am following this github project : Here.In that they mentioned to do :
Cocoapods
CocoaPods is the recommended way to add PNChart to your project.
Add a pod entry for PNChart to your Podfile pod 'PNChart'
Install the pod(s) by running pod install.
Include PNChart wherever you need it with #import "PNChart.h".
What i did is :
start the new project and add all frame works.
then i use terminal to create podfile like ( touch podfile )
then i move to my project folder to podfile file and i add this code
pod 'PNChart', '~> 0.8.7'
Then i use pod install to run .
then i add PNChart folder to my project, after that when i build i am not able to see my graph.
But when i download their project from github , then when i see their podfile file .its like this below code:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '6.0'
pod 'UICountingLabel','~> 1.2.0'
target :PNChartTests do
pod 'Expecta'
end
But when i copy these files to my podfile and when i run pod install in terminal . i am getting error no PNChartTest are seen
What i need to do first to work with line graph. please some one guid me to do,thanks!
UPDATED:
Error occur in this file : PNRadarChartDataItem.h- this file will be inside the PNChart folder
#import <Foundation/Foundation.h>
#interface PNRadarChartDataItem : NSObject
+ (instancetype)dataItemWithValue:(CGFloat)value
description:(NSString *)description;
#property (nonatomic) CGFloat value;
#property (nonatomic,copy) NSString *textDescription;
#end
3 error :
error in this line + (instancetype)dataItemWithValue:(CGFloat)value
description:(NSString *)description
error : Expected a type
error in this line - (void)setValue:(CGFloat)value {
error : Expected a type
error in this line #property (nonatomic) CGFloat value;
error : unknow type name cgfloat
Create new project.
Right click on 'Xcode project' in Xcode project navigator and choose others & empty file name 'Podfile' and select the destination as project directory level (Podfile should be at the xcodeproject file level) and add following lines
pod 'PNChart'
Close xcodeproject
Go to project directory and run the 'pod install' command from the termial
Open workspace i.e. .xcworkspace file
Import charts file in view controller such as
#import "ViewController.h"
#import "PNChart.h"
Added sample project here.
Related
I started a new react native application using :
react-native init myApplication
I started with splash screen so i used this library react native spalsh screen
I linked the library to generate native code using this command :
react-native link react-native-splash-screen
And i added files using Xcode like this :
In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
Go to node_modules ➜ react-native-splash-screen and add SplashScreen.xcodeproj
In XCode, in the project navigator, select your project. Add libSplashScreen.a to your project's Build Phases ➜ Link Binary With Libraries
To fix 'RNSplashScreen.h' file not found, you have to select your project → Build Settings → Search Paths → Header Search Paths to add: $(SRCROOT)/../node_modules/react-native-splash-screen/ios
I build the app using Xcode in a real Iphone and i get this error in RNSplashScreen.h :
/**
* SplashScreen
* 启动屏
* from:http://www.devio.org
* Author:CrazyCodeBoy
* GitHub:https://github.com/crazycodeboy
* Email:crazycodeboy#gmail.com
*/
#import <React/RCTBridgeModule.h> // <------'React/RCTBridgeModule.h' file not found
#import <UIKit/UIKit.h>
#interface RNSplashScreen : NSObject<RCTBridgeModule>
+ (void)showSplash:(NSString*)splashScreen inRootView:(UIView*)rootView;
+ (void)show;
+ (void)hide;
#end
'React/RCTBridgeModule.h' file not found
the Podfile :
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
...... # other libaries
pod 'react-native-splash-screen', :path => '../node_modules/react-
native-splash-screen'
AppDelegate.m :
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "RNSplashScreen.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
.... <------- other code
[RNSplashScreen show];
return YES;
}
Instead of
#import <React/RCTBridgeModule.h>
use
#import "RCTBridgeModule.h"
Hope this helps you. Feel free for doubts.
I'm very new to iOS and I'm coming from the Android background. I've read many post about this issue but I'm unable to resolve this issue.
My problem is that the app runs fine on the iPhone simulator but while running on the device it gives me following error -
error: 'AFNetworking.h' file not found
#import "AFNetworking.h"
^
<unknown>:0: error: failed to import bridging header ‘path/to/project/<main project directory>/projectName-Bridging-Header.h'
Update:
platform :ios, '7.0'
use_frameworks!
target 'SomeTarget' do
pod 'AFNetworking'
pod 'MSDynamicsDrawerViewController'
pod 'KRLCollectionViewGridLayout', '~> 0.2.0'
pod 'Canvas'
pod 'MBProgressHUD'
pod 'RBMenu'
pod 'RKTabView'
pod 'AHTabBarController'
pod 'Fabric'
pod 'Crashlytics'
end
My Bridging Header File
#import "AFNetworking.h"
#import "UIKit+AFNetworking.h"
#import "MSDynamicsDrawerStyler.h"
#import "KRLCollectionViewGridLayout.h"
#import "Canvas.h"
#import "MBProgressHUD.h"
#import "UIScrollView+TwitterCover.h"
#import "A3ParallaxScrollView.h"
#import "ParallaxHeaderView.h"
#import "UIImage+ImageEffects.h"
#import "SGFocusImageFrame.h"
#import "RBMenu.h"
#import "ILBarButtonItem.h"
#import "CMPopTipView.h"
#import "RKTabView.h"
#import "AHTabBarController.h"
#import "UIViewController+MJPopupViewController.h"
#import "NSString+FontAwesome.h"
#import “KMAccordionTableViewController.h"
#import <Crashlytics/Crashlytics.h>
Can you please point the issue I'm getting right now. Why it is running fine on emulator and not on actual device?
This might help somebody.
I've fixed this issue by adding an entry for Header Search Paths to "${PODS_ROOT}/" with recursive. Thanks to lostInTransit for pointing this attribute.
You can find Header Search Paths under BuildSettings for your project target.
The Setup
I have successfully integrated the GoogleMaps SDK into my Swift 2 project using CocoaPods.
My setup is pretty much that suggested by the Ray Wenderlich tutorial on the subject.
The only difference I can find is, I have to add this line to AppDelegate:
import UIKit
import GoogleMaps // <- THIS LINE
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate
{
...
...in order to use the framework's classes. The tutorial suggests importing:
#import <GoogleMaps/GoogleMaps.h>
...to the bridging header instead.
The app works without problems.
The Problem:
When I tried to run the test target auto-generated by Xcode, I get the error:
No such module 'GoogleMaps'
...pointing at the to the swift import statement in AppDelegate above.
So, I decide to switch to the way it is in the tutorial instead: I comment out the line import GoogleMaps in AppDelegate.swift and add an Objective-C-style import statement to the bridging header.
However, I can not get it right:
If I use: #import <GoogleMaps/GoogleMaps.h> or #import "GoogleMaps/GoogleMaps.h", it gives me:
Use of unresolved identifier 'GMServices'
at AppDelegate.swift when building the app target.
If I use: #import "GoogleMaps.h", it gives me:
'GoogleMaps.h': file not found
at the bridging header.
I have tried the solution in this answer, but the results are (puzzlingly) the same...?
Next, I checked the value of Build Settings / Search Paths / Framework Search Paths for both targets (app and tests). The app target had the entry:
"${PODS_ROOT}/GoogleMaps/Frameworks"
...which the test target lacked, so I added it, and reverted to the swift-style import (the only one that works at least when building the app target), but I still get:
import GoogleMaps <! No such module 'GoogleMaps'
How can I run tests for my app??
So, it turns out all I had to do is fix the Podfile (and run pod install), as explained in this answer.
My old pod file:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
def import_pods
pod 'GoogleMaps'
end
workspace 'MyWorkspace'
xcodeproj 'MyApp/MyApp.xcodeproj'
target : MyApp do
xcodeproj 'MyApp MyApp.xcodeproj'
pod 'GoogleMaps'
end
My current pod file:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
def import_pods
pod 'GoogleMaps'
end
workspace 'MyWorkspace'
xcodeproj 'MyApp/MyApp.xcodeproj'
target 'MyApp', :exclusive => true do
xcodeproj 'MyApp/MyApp.xcodeproj'
import_pods
end
target 'MyAppTests', :exclusive => true do
xcodeproj 'MyApp/MyApp.xcodeproj'
import_pods
end
I started a "Cocoa Touch Static Project" with a Cocoa Pods dependance.
Podfile:
platform :ios, '8.4'
inhibit_all_warnings!
target 'project' do
pod 'libPusher', '~> 1.6'
end
target 'project' do
end
A workspace has been created by the command "pod install".
Then I created un swift project on this workspace and I created a Bridge header between this swift project and my Objective-C library project.
My swift project configuration:
//:configuration = Debug
SWIFT_OBJC_BRIDGING_HEADER = demo/demo-Bridging-Header.h
//:configuration = Release
SWIFT_OBJC_BRIDGING_HEADER = demo/demo-Bridging-Header.h
When I compile my swift project, I obtain this error:
demo-Bridging-Header.h:5:9: In file included from /Users/XYZ/Projets/iOS/project/library/demo/demo/demo-Bridging-Header.h:5:
project.h:10:9: 'Pusher/PTPusherDelegate.h' file not found
Failed to import bridging header '/Users/XYZ/Projets/iOS/project/project/demo/demo/demo-Bridging-Header.h'
Do you know why the swift compiler doesn't found header file and how can I fix it?
• Did you run pod install ?
Installing SocketRocket (0.3.1-beta2)
Installing libPusher (1.6)
• Did you open demo.xcworkspace (close Xcode project, open Xcode workspace)
If so, were is the correct demo-Bridging-Header.h content:
#import "Pusher.h"
#import "Pusher/PTPusherDelegate.h"
As suggest title, I need to use InstagramKit (3.5.0) pod (written in objective-c) in a new swift project.
So I install pod (pod install), then I create my InstagramSwift-Bridging-Header.h and add-import library:
#import <InstagramKit/InstagramEngine.h>
Then, just building this empty project, I get:
/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h:5:9:
note: in file included from
/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h:5:
-(BOOL)application:(UIApplication *)application
^ <unknown>:0:
error: failed to import bridging header
'/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h'
Expected a type Failed to import bridging header
'/Users/.../workspace/InstagramSwift/InstagramSwift/InstagramSwift-Bridging-Header.h'
What could I miss?
After a lot of discussions with #eric-d, I probably find the problem in my podfile that was:
target "InstagramSwift" do
pod 'InstagramKit', '3.5.0'
end
So I deleted project and start again from an empty project using Podfile:
use_frameworks!
platform :ios, '8.0'
pod 'AFNetworking', '~> 2.5'
pod 'InstagramKit', '3.5.0'
Than I manually created SwitBridge.h and linked it in build settings.
Finally, in any swift file I can use instagramKit module, for example:
import InstagramKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let instagramEngine: InstagramEngine = InstagramEngine.sharedEngine()
}
}
Probably, problem was that platform setting is missing.
edit
Also,
"use_frameworks!"
thanks to this answer.