in my application i want to upload my image in jpg format to given link which content type must be multi part/form data and HTTP method is post without using any third party library. upon successful upload i will get link of uploaded image from server as a response. as i am new to IOS development. please help me in doing this Code. Thanks In advance
vendredi 31 juillet 2015
slide animation does not work with loading of images?
I have two views in my view controller.At one time i am showing just on view & on that view i am loading some images from server.I have given an arrow to view next view on right side.When i touch arrow icon then my first view is hide & second view is shown with a slide animation.
code for slide animation
CGFloat screenWidth=self.view.frame.size.width-68.0;
[self.back_view setHidden:false];
[self.front_view setHidden:true];
[UIView animateWithDuration:0.5 animations:^{
self.front_view.frame = CGRectOffset(self.front_view.frame, -screenWidth, 0.0);
self.back_view.frame = CGRectOffset(self.back_view.frame, -screenWidth, 0.0);
}];
CGFloat screenWidth=self.view.frame.size.width-68.0;
[self.back_view setHidden:true];
[self.front_view setHidden:false];
[UIView animateWithDuration:0.5 animations:^{
self.front_view.frame = CGRectOffset(self.front_view.frame, screenWidth, 0.0);
self.back_view.frame = CGRectOffset(self.back_view.frame, screenWidth, 0.0);
}];
so if the images are loading from network & i try to move the view then animation does not work properly my view is hidden & second view is not shown.But if the image loading works just fine.So what could be issue for which slide does not work properly?
UIStackView before iOS 9.0
I recently upgraded XCode to the latest Version 7.0 beta 3 (7A152u).
I am using Swift for building an iPhone app and when I try to use a Stack View in Main.storyboard I get the error "UIStackView before iOS 9.0".
I thought with the upgrade to Xcode 7 beta 3, I have iOS 9. Please correct my understanding as I am quite new to Swift development.
How to fix or disbale orientation of iOS device for few ViewController?
I have an app which is having 9-10 screens.I have embed navigation controller to my view controller.So i have few view controller for which i want set only portrait orientation it means on rotating the device view controller should not rotate to landscape mode.I have tried following solutions?
first:
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
but screen still rotates to landscape.
Second: I created custom view controller class as PortraitViewController & add below code in PortraitViewController.m
@interface PortraitViewController ()
@end
@implementation PortraitViewController
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
//Here check class name and then return type of orientation
return UIInterfaceOrientationMaskPortrait;
}
@end
After that i implemented PortraitViewController.h as base class
#import <UIKit/UIKit.h>
#import "PortraitViewController.h"
@interface Login : PortraitViewController
@end
does not work at all still allow view controller to rotate in landscape mode
Is there any other solution i am using iOS 8 & don't want viewcontroller to rotate in landscape mode?
How to upload video to service from the filepath(Documents directory) from iPhone in xamarin ios
I supposed to upload video to service using path of the video fiI supposed to upload video to service using path of the video file.currently video file is saved at the documents directory of the in iphone. like this "/var/mobile/Applications/9C4A08BC-9190-4A37-A875-3077236731AB/Documents/haedstycaracnd.mp4 Please tell me whether uploading is possible or not without converting video to nsdata from the file path?i,e..,I supposed to upload as the file(haedstycaracnd.mp4) not as stream of data.
I searched in google I found only objectiveC code,I didn't find any thing in xamarin(monotouch),I converted Objectve C to monotouch from here "http://ift.tt/1KGYsS6" but I am getting status code 500.while converting objectveC code to monotouch I may not get correct file path.
Please help in situation by providing the monotuoch code.
Step by step calculation mobile app
I intend to write a mobile app that does step by step differentiation, integration,limits,simplification etc. Though there are many apps in market already, I was wondering if this will be a good idea because most of these apps appear to be using libraries rather than being dedicated CAS(computer algebra systems) themselves, so they can't show the steps involved because libraries use numerical methods.
I understand it is a soft question, but I am seeking opinions.
Getting CFReadStreamRef and CFWriteStreamRef from CFSocket
-(void) createSocket
{
int sockfd;
struct sockaddr_in servaddr;
char sendline[] = "hello world";
char addr[] = “10.0.0.1";
sockfd=socket(AF_INET,SOCK_DGRAM,0);
bzero(&servaddr,sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr=inet_addr(addr);
servaddr.sin_port=htons(5527);
sendto(sockfd,sendline,strlen(sendline),0,
(struct sockaddr *)&servaddr,sizeof(servaddr));
// Create CFSocket
const CFSocketContext context = { 0, (__bridge void *) (self), NULL, NULL, NULL };
CFSocketRef _cfSocket;
_cfSocket = CFSocketCreateWithNative(NULL, sockfd, kCFSocketReadCallBack, kCFSocketReadCallBack, &context);
}
Hi,
I am new to objective c. As a part of a simple project I needed to build a UDP based client in objective c.
I have managed to create C based socket and get a CFSocket reference from it.
The place where I am stuck is:
Get a CFReadStreamRef and CFWriteStreamRef for the CFSocket that I have created.
is there a way that I can do that? I read the documentation for CFStream at apple but I couldn’t figure out much there. Any suggestions would be great.
Thanks
Can i write a part of an iOS app in python?
Note: There is a duplicate question, however I believe the answers may be outdated as a lot has changed since 2012 for iOS development.
I know that when programming for iOS you can bind to C/C++ from Objective-C. Can you do the same with Python, and if so, what is the best way to go about doing it? I would ideally like to write most of my app including the GUI in Objective-C and then write some python code to analyze some audio data using something like this. The only library I have found that may be able to this is PyObjC, but I read that this library is not well-supported for iOS. Is this is best option?
Thank you very much.
How to use an http endpoint in Swift--more details in body
New to using API's with iOS development and all. Lets say I have an endpoint:
So the user will input an email address, and PIN, and the device identifier (UDID) will go as well. The response will be saved into memory.
How can I make an HTTP request and save the response basically in Swift?
Rounding edge on UITextField
I have 3 UITextFields with border style none. I want to add borders in code. The effect I want to achieve is to have rounded top corners on first UITextField and to have rounded bottom corners on third text field. Code I am using for rounding edges is here Round top corners of a UIView and add border
But i get this - no right edge and corners are not rounded:
Note: I've set all constraints, that is not a problem. If i use UITextBorderStyleLine right edge is not rounded again.
Please help.
React Native: Cannot read property 'push' of undefined - Have NavigatorIOS and ES6 bind(this)
I am developing a react native application and I am attempting to route the user to the next view after successfully logging in through Facebook.
The problem is that I continue to get an error stating "Cannot read property 'push' of undefined." I have checked all the related answers on the forum and I have made sure to include NavigatorIOS and bind(this) on my function call - so those are the issue.
I would love assistance in determining what is wrong, as I am a novice dev.
Here is the error:
Error: Cannot read property 'push' of undefined
stack:
<unknown> index.ios.bundle:1498
MessageQueue.__invokeCallback index.ios.bundle:7235
<unknown> index.ios.bundle:7151
guard index.ios.bundle:7104
<unknown> index.ios.bundle:7151
<unknown> index.ios.bundle:7148
ReactDefaultBatchingStrategyTransaction.Mixin.perform index.ios.bundle:6552
Object.ReactDefaultBatchingStrategy.batchedUpdates index.ios.bundle:15885
Object.batchedUpdates index.ios.bundle:5084
URL: undefined
line: undefined
message: Cannot read property 'push' of undefined
============================
Here is my code
'use strict';
var React = require('react-native');
var Main = require('./App/Components/Main');
var Icon = require('./node_modules/react-native-vector-icons/FontAwesome');
var FacebookLoginManager = require('NativeModules').FacebookLoginManager;
var {
AppRegistry,
StyleSheet,
Text,
View,
TouchableHighlight,
NavigatorIOS,
Navigator,
} = React;
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
marginTop: 10
},
icon: {
fontSize: 20,
color: 'white',
paddingVertical: 5,
paddingHorizontal: 8,
borderRadius: 4,
backgroundColor: '#3b5998',
},
text: {
marginLeft: 10,
color: 'white',
fontWeight: '600',
},
});
class nomsyapp extends React.Component {
constructor(props) {
super(props);
this.state = {
result: 'Find the Foods that Fit Your Lifestyle',
loggedIn: false,
};
}
login() {
FacebookLoginManager.newSession((error, info) => {
if (error) {
this.setState({result: error});
} else {
this.setState({result: info});
this.setState({loggedIn: true});
this.props.navigator.push({
component: Main,
title: 'Choose Your Lifestyle',
});
}
});
}
render() {
return (
<View style={styles.container}>
<TouchableHighlight onPress={this.login.bind(this)}>
<Icon name="facebook" style={styles.icon}>
<Text style={styles.text}>Login with Facebook</Text>
</Icon>
</TouchableHighlight>
<Text style={styles.instructions}>
{this.state.result}
</Text>
</View>
);
}
};
AppRegistry.registerComponent('nomsyapp', () => nomsyapp);
============================
Swift dyld: Library not loaded - using CoCoapods
I apologize for what may seem like an overly asked question, but no matter how many answers to related questions I'm asking, none of them seem to work. See (in order) here, here, here, and here.
I'm running XCode 6.4 with iOS 8 (iPhone only), using CoCoaPods. Many of other answers provided, there seems to be a build setting, or general setting that does not exist in my version of XCode, yieling many conclusions not helpful.
As a matter of reference, I followed This CocoaPod Tutorial which worked with ease. But it's only when I attempt to load the app onto my phone (yes, I have valid certificates, and my other apps work just fine without using other dependencies), the app immediately crashes just as it's about to load.
dyld: Library not loaded: @rpath/Pods_ExamplePods.framework/Pods_ExamplePods
Referenced from: /private/var/mobile/Containers/Bundle/Application/F109A377-3EA4-48C2-9042-CB6C384C9F30/http://ift.tt/1KG8T8A
Reason: image not found
(lldb)
See here where I named my app "ExamplePods"
And then here is my Folder Structure, opened in Workspace mode. Note that there's only 3 dependencies.
Then see "General Settings" and "Build Settings"
I'm at a complete loss, help is much appreciated!
Determine the Device Orientation and its resulting Angle on one Dimension?
I have the following setup:
An iPhone lies with the display to the ceiling on a table (alpha = 0 degrees). When the iPhone is moved upwards like shown in the image above the alpha angle increases.
How do I compute the value of the alpha angle without taking care of any other axes which could change. I am only interested in this one axis.
How do I get the correct alpha angle the iPhone has when lifting up from the table? How do I get notified when the value of alpha changes?
Core data:- How to update values in the array (Transformable)
I work on app that use Core data to save data in local device. In Core data i have save data in array using Transformable format but, i don't know how to update particular values in the array. My code for update Array is here
NSManagedObjectContext *context = [self managedObjectContext];
NSManagedObject *user = [NSEntityDescription insertNewObjectForEntityForName:@"Type" inManagedObjectContext:context];
NSError *error = nil;
//Set up to get the thing you want to update
NSFetchRequest * request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Type"inManagedObjectContext:context];
[request setEntity:entity];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"businessTypes == %@", @"Others"];
[request setPredicate:predicate];
AppDelegate *app = (AppDelegate*)[[UIApplication sharedApplication]delegate];
NSArray *results = [self.managedObjectContext executeFetchRequest:request error:&error];
if (results == nil) {
// This implies an error has occurred.
NSLog(@"Error from Core Data: %@", error);
} else {
if (results.count == 0) {
// No objects saved, create a new one...
} else {
// At least one object saved. There should be only one
// so use the first...
user = [results lastObject];
[user setValue:@"Management" forKey:@"businessTypes"];
}
}
if (![self.managedObjectContext save:&error]) {
//Handle any error with the saving of the context
}
else{
[app saveContext];
NSLog(@"update value successfully");
}
and below is my save array in core data:
{
businessTypes = (
"Social Bussiness",
Marketing,
Transports,
Others
);
},
so i want to update "Others" to "Management" in the array.
When i run this code i have no error but i don't update particular value at index array. thanks to help me.
Best practice for core data model object save
I have a two entity "Person" and "Car" is coming from the web service. I need to store that in sqlite through core data. I want to know what is the best approach should i bind the save method with NSmanagedobject or write differently in utility or manager?
**Approach 1**
@interface Person : NSManagedObject
@property (nonatomic, retain) NSString * title;
- (void) saveManagedObject:(NSDictionary*)response //Responsible for init the person object and save in context
@end
**Approach 2**
@interface CoreDataUtility : NSObject
- (void) saveManagedObject:(NSDictionary*)response //Responsible for create the person object and save in context
@end