I use this code to post in facebook from my app in iphone
NSString *title=[NSString stringWithFormat:#"Posted from Poems of Love v2 iPhone/iPod/iPad touch app - { Poem Name: "];
//& titletext.text & ""\",";
NSString *alltitle= [title stringByAppendingString:poemtitle.text];
alltitle= [alltitle stringByAppendingString:#" } - { Author:"];
alltitle= [alltitle stringByAppendingString:authorname.text];
NSString *alltitle1= [alltitle stringByAppendingString:#" }"];
NSString *list = poembody.text;
NSString *kAppId=#"numid";
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, #"app_id",
#"http://www.poemsofloveapp.com", #"link",
#"http://3.bp.blogspot.com/_co4MVQE_2l0/TPRh6TBjaZI/AAAAAAAAAOg/E0kgWLd4ieE/s1600/poemsoflovev2logo.png", #"picture",
alltitle1, #"name",
#"\nhttp://www.poemsofloveapp.com - Join us on facebook!\n", #"caption",
list, #"description",
#"",#"message",
nil];
[mainDelegate._session dialog:#"feed" andParams:params andDelegate:self];
The dialog shows up i tap skip or publish and then a second dialog shows up which is empty! no message on it nothing
Why is this happening?
My mistake sorry guys i called [mainDelegate._session dialog:#"feed" andParams:params andDelegate:self];
two times previously stupid i know!!!
Related
I am using GPUImageMovie with initWithPlayerItem and its not starting the movie file on startProcessing. It was working fine with initWithUrl but I need playback controls for the player as told in this thread. I am using the following code
-(void)loadVideo
{
_playerItem = [[AVPlayerItem alloc]initWithURL:movieURL];
_player = [AVPlayer playerWithPlayerItem:_playerItem];
movieFile = [[GPUImageMovie alloc] initWithPlayerItem:_playerItem];
movieFile.runBenchmark = YES;
movieFile.playAtActualSpeed = YES;
filter = [[TSFilter alloc] init];
_movieView = [[GPUImageView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:_movieView];
[self.view sendSubviewToBack:_movieView];
[movieFile addTarget:filter];
[filter addTarget:_movieView];
_player.rate = 1.0;
[movieFile startProcessing];
[_player play];
}
And finally after spent a lot of time I found the solution to this silly problem. I came to that solution when I tried bundled file instead of a file in a document directory. I think it is the bug in AVPlayerItem:initWithUrl method that is not working with the NSUrl value from document directory. Let me explain it in detail
When I get the Url of the file from document directory its value is
/var/mobile/Applications/7B3229B0-D18E-405D-BBA0-E9D57F2842C4/Documents/SkyFall_clip.m4v
but if I bundled this file and get the url from [NSBundle mainBundle] then its value is
file:///var/mobile/Applications/7B3229B0-D18E-405D-BBA0-E9D57F2842C4/Documents/SkyFall_clip.m4v
So I found that "file://" keyword is missing in the url for the document directory file. So i just append "file://" in the beginning of the url and it starts working. Although this should not be the case because both are the valid NSUrl and working for other classes like UIImage.
Note: Implement the string append operation is such a way that it append only if it is missing.
I am having an issue running GPUImage. I have modified SimpleVideoFileFilter program(replaced the filter with a chromakeyfilter) and am using my own video. My program is terminating due to the following error:
[AVAssetWriter startWriting] Cannot call method when status is 3'
I have gone through the forums but not sure why the moviewriter is closing and then someone is writing to it.
I am using iPhone4 running iOS 7.0
Any clues are greatly appreciated. Thanks much!
Check whether your destination file exists already. If it does, remove it.
I was trying to add the file to a directory which did not exist. Example : /Videos/Video.mov , leaving it just /Video.mov worked.
Ok, I have a few ideas for you.
When you say "it just shows a frame and never plays the video" we have a good indication that your entire processing pipeline from start to finish is functional exactly once, then stops working.
That tells us that you are stringing things together correctly, but some of the components don't exist longer than a single frame buffer cycle, and subsequently the whole process stops.
it looks like filter and movieWriter are scoped to the class (I'm assuming they're not properties from the lack of an underscore, _filter and _movieWriter). So they will live on after this method has finished (correct me if I'm wrong...)
I think where you are encountering trouble is your (GPUImageView*)displayView
This should probably be declared as a class property (although it could work as just a variable) and then instantiated through the nib or the viewDidLoad method of the view controller.
As you have it now, this line: GPUImageView* filterView = (GPUImageView*)displayView; is making an assignment for filterView which is not used (and therefore unnecessary). It's not clear if displayView really is an instance of GPUImageView or if it will still be in existence when the current method finishes. (in fact you say it "is a UIView that I have programmatically created")
displayView will have to be a subclass of GPUImageView for this whole thing to work, and it will have to be scoped to the class, and not the method.
Declare it like this:
#property (strong, nonatomic)GPUImageView* displayView;
and then instantiate it and add it to your view hierarchy from within viewDidLoad
movieFile1 = [[GPUImageMovie alloc] initWithURL:movieFileURL1];
movieFile2 = [[GPUImageMovie alloc] initWithURL:movieFileURL2];
movieFile2.runBenchmark = YES;
movieFile2.playAtActualSpeed = NO;
filter = [[GPUImageChromaKeyBlendFilter alloc] init];
[(GPUImageChromaKeyBlendFilter *)filter setColorToReplaceRed:0.0 green:1.0 blue:0.0];
[(GPUImageChromaKeyBlendFilter *)filter setThresholdSensitivity:0.4];
GPUImageView *filterView = (GPUImageView*)displayView;
[filter addTarget:displayView];
[movieFile1 addTarget:filter];
[movieFile2 addTarget:filter];
NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:#"Documents/Movie.m4v"];
unlink([pathToMovie UTF8String]);
NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];
movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(1920.0, 1280.0)];
[filter addTarget:movieWriter];
movieWriter.shouldPassthroughAudio = YES;
movieFile1.audioEncodingTarget = movieWriter;
[movieFile1 enableSynchronizedEncodingUsingMovieWriter:movieWriter];
[movieWriter startRecording];
[movieFile1 startProcessing];
[movieFile2 startProcessing];
[movieWriter setCompletionBlock:^{
[filter removeTarget:movieWriter];
[movieWriter finishRecording];
}];
if (outputPath) {
finalURL = [[stongObj tempFileURL] copy];
DebugLog(#"Start Filter Processing :%#",finalURL);
DebugLog(#"movieUrl :%#",movieUrl);
// [CSUtils removeChuckFilePaths:#[outputPath]];
//Create Image Movie Object
_movieFile = [[GPUImageMovie alloc] initWithURL:outputPath];
//_movieFile = [[GPUImageMovie alloc] initWithURL:[[NSBundle mainBundle] URLForResource:#"videoviewdemo" withExtension:#"mp4"]];
_movieFile.runBenchmark = NO;
_movieFile.playAtActualSpeed = YES;
_movieFile.delegate = self;
//Movie Writer Object
_movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:finalURL size:CGSizeMake([UIScreen mainScreen].bounds.size.height,[UIScreen mainScreen].bounds.size.height)];
//_movieWriter.delegate = self;
//Create Selecetive GPU Image Filter
[stongObj setGpuOutputFilter:selectedVideoFilterType];
//Create Group Filter
groupFilter = [[GPUImageFilterGroup alloc] init];
[groupFilter addTarget:imageOutputFilter];
// Only Single Filter is implemented.
//Apply Initial and Terminal Filter
[(GPUImageFilterGroup *)groupFilter setInitialFilters:[NSArray arrayWithObject:imageOutputFilter]];
[(GPUImageFilterGroup *)groupFilter setTerminalFilter:imageOutputFilter];
//_movieWriter -> groupFilter ->_movieFile
[_movieFile addTarget:groupFilter];
[groupFilter addTarget:_movieWriter];
_movieWriter.shouldPassthroughAudio = YES;
_movieFile.audioEncodingTarget = _movieWriter;
[_movieFile enableSynchronizedEncodingUsingMovieWriter:_movieWriter];
//Start Recording
[_movieWriter startRecording];
//Start Processing
[_movieFile startProcessing];
__weak typeof(self) weekSelf=self;
[_movieWriter setCompletionBlock:^{
__strong typeof(self) stongSelf=weekSelf;
DebugLog(#"Movie Write Completed");
//Finish Recording.
[stongSelf.movieWriter finishRecording];
//Release all object
// [self releaseAllObject];
//remove movieUrl,audioUrl,outputPath
[CSUtils removeChuckFiles:#[movieUrl,audioUrl,outputPath]];
}];
[_movieFile startProcessing]; app get crash in iOS 8 on this line but working fine on iOS 7
#Seasia Creative ,I have no enough reputation to add a comment by that list,I create a new list to answer U.
I check the output URL,console log "/var~~~~/tmpmerge.mp4",so i realize that ,i miss a "/" --->"/var~~~~/tmp/merge.mp4".
If the url is no correct, project runs into the same error.
hope to help some.
I currently have a map displaying 10 or so co ordinates.The map gets the users location and centers on it as soon as it is opened. When panning the page or zooming different levels it eventually resets and centers in on the first position of the user.I have tried "stopupdating location" and Animated as "NO".I can not get it to stay in positon when the user scrolls the map.
- (void)viewDidLoad {
[super viewDidLoad];
self.petrolMap.delegate = self;
self.location = [[CLLocationManager alloc] init];
[location setDelegate:self];
[location setDistanceFilter:0]; // Do not apply a distance filter to the map
[location setDesiredAccuracy:kCLLocationAccuracyBest]; // Use the best accuracy possible when displaying the map
petrolMap.delegate=self; // Display on "Petrol Map" , the mapview for the application}
-(void) mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation{MKCoordinateRegion mapRegion;
mapRegion.center = petrolMap.userLocation.coordinate;
mapRegion.span.latitudeDelta=0.02;
mapRegion.span.longitudeDelta=0.02;
[petrolMap setRegion:mapRegion animated:NO];}
Your 'location' is a location manager, when it works out where you are it'll send its delegate
locationManager:didUpdateToLocation:fromLocation:
which you don't seem to have, so all those settings you're doing to 'location' are wasted (as far as the code you've given us, it may be useful elsewhere) and telling it to stop tracking the user is of no use.
"(void) mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation{MKCoordinateRegion mapRegion;" is what petrolMap is sending to its delegate. Somewhere you must have set petrolMap to track the user, it can be done in the .xib.
Anyway, to stop petrolMap sending messages make sure you run
[petrolMap setUserTrackingMode:MKUserTrackingModeNone animated:NO];
Some extra notes:
Within didUpdateUserLocation you don't need to refer to petrolMap directly because the mapView parameter is set to which ever MKMapView sent the message.
Also within didUpdateUserLocation you are using petrolMap's userLocation instead of the parameter userLocation, and even building your region. The entire code for that function could be one line
[mapView setRegion:mapRegion animated:NO];
'Animated' controls how the change in region is done. Yes means it will slide between locations, No means it will snap from one to the other instantly, either way the map will move to the new region.
Your viewDidLoad method could be cut to two lines like follows
[super viewDidLoad];
self.petrolMap.delegate = self;
Addendum:
locationManager:didUpdateToLocation:fromLocation
is deprecated in iOS6.
Unfortunately this is a few years to late for you James - but hopefully it'll help others who are stuck in this situation (like myself).
I ended up adding...
[self.mapView setUserTrackingMode:MKUserTrackingModeFollow];
Into my -(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
You should normally add "animated:YES" at the end, but this again would ping it back to my current location, even if I changed the commander to "NO" - so tried deleting it and it worked!!!
Just for reference my whole code became:
-(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation{
if(userLocationShown) return;
MKCoordinateRegion region;
MapView.showsUserLocation = YES;
region.center.latitude = MapView.userLocation.coordinate.latitude;
region.center.longitude = MapView.userLocation.coordinate.longitude;
region.span = MKCoordinateSpanMake(0.02,0.02);
[MapView setRegion:region animated:YES];
[self.mapView setUserTrackingMode:MKUserTrackingModeFollow];
[locationManager startUpdatingLocation];
[locationManager stopUpdatingLocation];
userLocationShown = YES;
and I added...
- (void)viewDidLoad {
[super viewDidLoad];
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
MapView.delegate = self;
I'm working on a project in which I'm using the mail-core iphone api to send and retrieve mail. I have tried a lot of things, but have been unable to find any solution. I've tried searching but haven't found any solution. Could someone explain how to use the mail-core api to send attachments?. If anybody knows how to do that please let me know.
I haven't tested this but if you look at the header for CTCoreMessage, it does have a method addAttachment:. Argument for this is a CTCoreAttachment object.
Add this only and only after you setBody or setHTMLBody:
// Set Attachments
NSString *filePrefix = [[NSBundle mainBundle] bundlePath];
NSString *path = [NSString stringWithFormat:#"%#/%#",filePrefix,#"TestData/DSC_6201.jpg"];
NSLog(#"path:%#", path);
CTCoreAttachment *attach = [[CTCoreAttachment alloc] initWithContentsOfFile:path];
if ([attach data]==nil) {
NSLog(#"Error: attachment data is nil");
}
[myMessage addAttachment:attach];
Here, you should add TestData folder with image to your project as a folder reference
Hi all
I've create simple movie player in iPhone development. But i got just only vedio's voice.
Here is my code (when button click),
-(IBAction)playMe{
NSBundle *bundle=[NSBundle mainBundle];
NSString *moviePath=[bundle pathForResource:#"iiii" ofType:#"mp4"];
NSURL *movieURL = [NSURL fileURLWithPath:moviePath];
MPMoviePlayerController *theMovie=[[MPMoviePlayerController alloc] initWithContentURL:movieURL];
theMovie.scalingMode = MPMovieScalingModeAspectFill;
[theMovie play];
[self.view addSubview:theMovie.view];
}
When i click i got only voice not with movie. I also used iOS 4.1 simulator.
it may be because of you have not set frame to display movie player try this.
theMovie.view.frame=CGRectMake(0,0,300.400);
If this does not work
you can check out following tutorials
http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-play-video-in-iphoneos4/
http://iosdevelopertips.com/video/getting-mpmovieplayercontroller-to-cooperate-with-ios4-3-2-ipad-and-earlier-versions-of-iphone-sdk.html
http://www.devx.com/wireless/Article/44642/1954
http://iosdevelopertips.com/video/how-to-play-movies-from-application-bundle-or-from-a-remote-server-url.html