vendredi 27 mars 2015

How to measure latency in iOS

Is there away to measure latency for one specific page?


Can I do some requests and calculate the average to know the latency?




NSDateFormatter string to date conversion

I need to convert



3/27/2015 5:45:00 AM


string into an NSDate object.


I tried this;



[dateFormatter setDateFormat:@"MM/dd/yyyy hh:mm:ss a"];


but it does not work.


What might be wrong that i could not figure out?


Thanks




Location permission alert on iPhone with Cordova

I'm working on a cordova app on which I have to locate the user latitude and longitude. Using the geolocation plugin, it works fine on android devices but it display an alert asking for permission from user in iOS. When I used the simulator I get this alert message:



Users/user/Library/Developer/CoreSimulator/Devices/783A2EFD-2976-448C-8E4E-841C985D337D/data/Containers/Bundle/Application/EFC846BB-4BA3-465C-BD44-575582E649FC/app_name.app/www/index.html would like to use your current location.


I have seen topic talking about this problem like: this but none of the provided solutions works for me.


this is my geolocation function:



function loadMyCoordonnee() {
if (navigator.geolocation) {
navigator.geolocation
.getCurrentPosition(
function(position) {
var myLatlng = new google.maps.LatLng(
position.coords.latitude,
position.coords.longitude);
window.localStorage.setItem("lattitude",
position.coords.latitude);

window.localStorage.setItem("longitude",
position.coords.longitude);
console.log('lattitude : '
+ window.localStorage.getItem("lattitude"));
console.log('longitude : '
+ window.localStorage.getItem("longitude"));
}, function(error) {

var myLatlng = new google.maps.LatLng(
47.120547402337465, 2.651801171874922);
window.localStorage.setItem("lattitude",
47.1205474023374655);
window.localStorage.setItem("longitude",
2.651801171874922);

});
} else {

window.location = "index.html";
}
}


and here where I called this function:



var app = {

initialize: function() {
this.bindEvents();
},

bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},

onDeviceReady: function() {
loadMyCoordonnee();
//app.receivedEvent('deviceready');

},

receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');

listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');

console.log('Received Event: ' + id);
}
};

app.initialize();


Is there any way to change the text of the alert or to disable this alert?




iOS UICollectionView Photo Gallery Orientation issue

I'm currently working on implementing a horizontally scrollable photo gallery feature. For this, I'm using UICollectionView with the flow layout set to horizontal. The problem that I'm currently facing is with the orientation. Lets say, I launched this view in landscape and i scrolled across couple of photos and now if change orientation to portrait, i'm loosing the position where i was before in the landscape mode. i want to make sure i show the same photo centered vertically that i have before changing the orientation. please find the included source code below.



class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {

var collectionView: UICollectionView!
private var samplePictures:[UIImage] = []
let CELL_IDENTIFIER = "photo_cell"
var currentIndex = 0
var flowLayout: UICollectionViewFlowLayout!


override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.

samplePictures = [UIImage(named: "Photo-1.png")!, UIImage(named: "Photo-2.png")!, UIImage(named: "Photo-3.png")!, UIImage(named: "Photo-4.png")!, UIImage(named: "Photo-5.png")!, UIImage(named: "Photo-6.png")!]

flowLayout = UICollectionViewFlowLayout()
flowLayout.scrollDirection = UICollectionViewScrollDirection.Horizontal
flowLayout.minimumInteritemSpacing = 0.0
flowLayout.minimumLineSpacing = 0.0
flowLayout.sectionInset = UIEdgeInsetsMake(0.0, 0.0, 0.0, 0.0)

collectionView = UICollectionView(frame: self.view.bounds, collectionViewLayout: flowLayout)
collectionView.delegate = self
collectionView.dataSource = self
collectionView.showsHorizontalScrollIndicator = false
collectionView.showsVerticalScrollIndicator = false
collectionView.autoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth
collectionView.pagingEnabled = true
collectionView.registerClass(SampleCollectionCell.self, forCellWithReuseIdentifier: CELL_IDENTIFIER)

self.view.addSubview(collectionView)
}

override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
collectionView.reloadData()

}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return 1
}

func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return samplePictures.count
}

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {

var cell = collectionView.dequeueReusableCellWithReuseIdentifier(
CELL_IDENTIFIER, forIndexPath: indexPath) as SampleCollectionCell

cell.backgroundColor = UIColor.brownColor()
cell.imageView_sample.image = samplePictures[indexPath.item]

return cell
}

func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
return self.view.bounds.size
}


override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
collectionView.collectionViewLayout.invalidateLayout()
}

//supports all orientations
override func supportedInterfaceOrientations() -> Int {
return Int(UIInterfaceOrientationMask.All.rawValue)
}

//view will rotate when the interface orientation happens
override func shouldAutorotate() -> Bool {
return true
}
}


This is the source code for the CustomCollectionCell that I'm using



class SampleCollectionCell: UICollectionViewCell {
var imageView_sample: UIImageView!

override init(frame: CGRect) {
super.init(frame: frame)

imageView_sample = UIImageView(frame: self.bounds)
imageView_sample.contentMode = UIViewContentMode.ScaleAspectFit
self.contentView.addSubview(imageView_sample)

}

required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func layoutSubviews() {
super.layoutSubviews()
self.imageView_surveillance.frame = self.bounds
}
}


Any help is truly appreciated. The core idea behind using this is to mimic the Photo app and also update view components when i scroll a picture. Please suggest if you think this can be done in a better way.


Regards.




how to know which text field is editing and can is get it coordinates in iOS?

I am trying to show a tableview just below the text field. I am having 5 text field in this page. I want to show the same table on all the 5 text fields (created the table programatically) please can any one help me




Unable to add a source with url

[!] Unable to add a source with url git@github.com:CocoaPods/Specs.git named master-1. You can try adding it manually in ~/.cocoapods/repos or via pod repo add. please any help




Custom View with dynamic Height as UITableView Header ios xcode

In my project,i have a 1.MovieplayerView,2.a label with dynamic content,3.a tableView with variable number of rows.


I was doing this with all these views in scrollView.But i always have the issue with dynamic height of the label.it sometime overlaps the tableView.


I came to know that we can use customView as the tableView header.How this can be done with variable content Height and autolayout?I am new to iOS.Any suggestion ??


I know how to add a view as the header to a table.But when the contents in the view changes,it overlaps the contents of the tableView.


I went through How to resize superview to fit all subviews with autolayout?,How do I set the height of tableHeaderView (UITableView) with autolayout?


Can some one give a simple example on how to do this?Or tell me if it is better to use a scrollview and add all these views as its subviews? any suggestion would be realy helpful.Thanks.




Obtaining a complete NSString from one class to another for the title of a UIButton

I have a simple application and I am now implementing In App Purchases. The layout of the problem at hand is simple:



  • I have a IAPViewController which contains the elements like a UIButton and UILabel

  • I have a e100EntriesPurchase which is what is doing the actual IAPs.


When the user clicks on an element like a UIButton in the IAPViewController, it invokes a method in the e100EntriesPurchase class which shows a UIAlertView to the user. The otherButtonTitle has a formatted text to show the price in your local country.



- (void)displayStoreUI
{
// Obtain formatted price
[self obtainPurchasePricing];

NSLog(@"HERE THE PRICE IS %@", self.productPrice);

NSString *obtainedProductPrice = self.productPrice;
NSLog(@"THE OBTAINED PRODUCT PRICE IS %@", obtainedProductPrice);

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:self.productBeingPurchased.localizedTitle message:self.productBeingPurchased.localizedDescription delegate:self.delegate cancelButtonTitle:obtainedProductPrice otherButtonTitles:@"Maybe later", nil];
alertView.tag = 999;
[alertView show];
}

- (NSString *)obtainPurchasePricing
{
// Displays Local Currency
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
formatter.formatterBehavior = NSNumberFormatterBehavior10_4;
formatter.numberStyle = NSNumberFormatterCurrencyStyle;
formatter.locale = self.productBeingPurchased.priceLocale;
self.productPrice = [NSString stringWithFormat:@"Buy this for %@", [formatter stringFromNumber:self.productBeingPurchased.price]];
NSLog(@"The price is %@", self.productPrice);
return self.productPrice;
}


All of the NSLogs are showing the price appropriately.


Now from my IAPViewController, I want the title of the UIButton to be the same as what it is set in the obtainPurchasePricing method, so:



NSString *obtainedPrice = [self.e100EntriesPurchase obtainPurchasePricing];
[self.iap100Button setTitle:obtainedPrice forState:UIControlStateNormal];
NSLog(@"The price is %@", obtainedPrice);


The problem I am facing is that the title of the UIButton is "Buy Now for (null)". The NSLog also doesn't show the actual price. This code above is in the viewDidLoad of the IAPViewController.


The properties in the e100EntriesPurchase class are:



@property (nonatomic, strong) SKProduct *productBeingPurchased;
@property (nonatomic, strong) NSString *productPrice;


What am I missing to obtain the actual price?


Any thoughts on this would really be appreciated!


Update


Through some extensive debugging, I have seen the pattern for what goes on when the UIButton is pressed (because at that point, the price is displayed correctly and therefore self.productsBeingPurchased is not nil).



- (void)validateProductIdentifiers
{
// Asking the App Store - I'm supposed to buy this product, does it exist? If it does, we'll get back a product.
NSLog(@"validateProductIdentifiers");
SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:self.iap100EntriesPurchase]];
// Set the delegate
request.delegate = self;
// Call the start method on that request
[request start];

}

- (void)makeThePurchase
{
NSLog(@"makeThePurchase");
SKPayment *payment = [SKPayment paymentWithProduct:self.productBeingPurchased];
[[SKPaymentQueue defaultQueue]addPayment:payment];
}

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSLog(@"productsRequest");
// This method is saying there is a product request and is there a response reeived.
// We'll grab a reference to that product.

// There is only one product on iTunes Connect, so we can just grab that product. With more than one, we'd have to loop through all of the available products.
// grab a reference to our product.
self.productBeingPurchased = response.products.firstObject;

// Now that we have a product, let's display a store UI.

if ([SKPaymentQueue canMakePayments])
{
// Can we actually buy thigns? Yes we can buy stuff. It's a good idea to check this. We'll create a method to display the store UI.
[self displayStoreUI];
}
else
{
// in app purchaes are disabled in the settings
[self cantBuyAnything];
}
}


From the IAP, if I run [self.e100EntriesPurchase validateProductIdentifiers] before calling the obtainPurchasePricing, it still shows NULL as the button title (Buy Now for NULL), but it then invokes the displayStoreUI method after a few seconds, so that's clearly not right.


Possible Duplicate


The question has been marked as a possible duplicate, but none of the answers in the proposed question work for me; the issue is still the same even after I've set up the delegate mechanism.




UIScrollview is not scrolling beyond UIView height even though UIView frame is increased

I am trying to create a screen where scrolling is required in iphone 3.5 inch screen . I have attached images which contain the configuration of uiviewcontroller , uiscrollview , uiview . The problem is eventhough the height seems to increase , when i run iPhone 4s , some part of scroll is hidden beyond the UIView (Although uiview height shows 700 when i print the height in console) . What might be the problem ? Please help me ?enter image description here


enter image description here


enter image description here


enter image description here


enter image description here


enter image description here


enter image description here


enter image description here


enter image description here




jeudi 26 mars 2015

Pushkit voip push notifications are not being received on iOS8.0.2

I implemented new pushkit voip push notifications and until now it has been working properly in all iOS8 devices I tested except one. I ve got an iPhone iOS 8.0.2 which is not receiving any voip push. It registers correctly as I get the pushRegistry:didUpdatePushCredentials: forType: delegate called I tested previous remote pushes (registerForRemoteNotifications) with success but none of sent voip push are received.


So my questions are:


*Anyone has experienced same behavior for pushkit voip push notifications?


*Could it be something related with iOS version (iOS 8.0.2)?


*Could anyone having this version (iOS 8.0.2), implementpushkit voip push and try to receive a voip push notification in order to discard version problem?


If you need to implement pushkit voip push notifications you can check my answer on stackoverflow question




Renaming a project in Xcode, I cannot rename anymore and it crashes

I tried to rename my project in xcode, but when I tried to go to a second view controller, everything crashed. So, I tried to rename it one more time. But now I am really stuck...


It is now saying that it is running 'myNewName.temp_caseinsensitive_rename' on iPhone and still everything crashes when I go to the second view controller. But now, I cannot change it. Everytime I change it, the '.temp_caseinsensitive_rename' is still there... Crap, What should I do! I am really lost now...


I am using xcode 6.2 on Mavericks.




Is there support in Cordova to WKWebView?

I would like to know if is possible use WKWebView with cordova. And if this is possible, how I can use.


I read that cordova 4.0 maybe will use WKWebView, but I can't find if this is in production.




swift sqlite3 - sqlite3_open not creating database

I'm writing my first swift universal app. I have used Sqlite3 in objective-c apps before so I would like to think i have a fairly decent knowledge of it. I'm using Sqlite3 to store data that is downloaded from a server when the app first loads. The problem i'm having is that when I run the app on the IOS simulator it works just fine, however when I run it on an actual device it doesn't seem to be creating the database file.


I have the following code



func dataFilePath() -> String
{
let documentDirectory = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as String
return documentDirectory
}
func dataFile() -> String
{
return "App.sqlite3"
}

func InitialiseDatabase()
{
var databaseName = dataFilePath()
databaseName += dataFile()

var database:COpaquePointer = nil
var result = sqlite3_open(databaseName, &database)
if result != SQLITE_OK {
println(sqlite3_errmsg(database));
sqlite3_close(database)
return
}

.......... more code here


When this runs it is not returning SQLITE_OK on the actual device. I'm wondering if it's some sort of permissions issue? sqlite_3_errmsg just returns some code which doesn't bring up any results on google so that hasn't helped.


Any ideas?




memory leak when using images in Swift?

I have a very simple app with two viewControllers at the moment. I have a transition between them (with a segue of course) and both screens have a lot of images and buttons with images.


What I discovered was that there is a memory leak when you alternate between the screens. I am guessing, that somehow the images are loaded again each time you open the viewController again. Around 6MB is added each time and I am pretty sure that the images are less than 1MB in total. So maybe there is something else craving all the memory?


I have 6 image Views and I use the cross dissolve transition in the default modus. I wish I could copy some code here, but it is a big project and I would not know what code would be helpful.


So my question would be: what is causing this problem (and preferable how can I fix this)? Is it the images, or maybe the segues with the transition.


Any help would be really appreciated! Thanks!




Can I keep my app in Testflight during approval process

Does anyone know if you can keep your app in TestFlight during the approval process?




In iOS, how to drag down to dismiss a modal?

A common way to dismiss a modal is to swipe down - How do we allows the user to drag the modal down, if it's far enough, the modal's dismissed, otherwise it animates back to the original position?


For example, we can find this used on the Twitter app's photo views, or Snapchat's "discover" mode.


Similar threads point out that we can use a UISwipeGestureRecognizer and [self dismissViewControllerAnimated...] to dismiss a modal VC when a user swipes down. But this only handles a single swipe, not letting the user drag the modal around.




Core data migration error Cocoa error 134130 Can't find model for source store

My app is live on the app store. I made an update with changes to the core data model. I followed the core data light migration on Apple dev website.



  • Add a new version of the model in Xcode

  • Make changes to the new model version

  • Select the option to use the new version for the model (new model version has the green check)

  • Add options when add sqlite file to the persistent store


Here is the code:



NSString *momdPath = [[NSBundle mainBundle] pathForResource:@"PropertiesModel" ofType:@"momd"];
model = [[NSManagedObjectModel alloc] initWithContentsOfURL:[NSURL fileURLWithPath:momdPath]];

// model = [NSManagedObjectModel mergedModelFromBundles:nil];

psc = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model];

NSString *path = [self itemArchivePath];
NSURL *storeURL = [NSURL fileURLWithPath:path];

NSError *error = nil;
NSDictionary *options = @{ NSMigratePersistentStoresAutomaticallyOption : @(YES),
NSInferMappingModelAutomaticallyOption : @(YES),
NSSQLitePragmasOption : @{@"journal_mode" : @"DELETE"}};
if (![psc addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil
URL:storeURL
options:options
error:&error]) {
CLS_LOG(@"store URL: %@ \n options: %@ \n error: %@",storeURL,options,error);
[NSException raise:@"Open failed" format:@"Reason: %@, Full Error: %@", [error localizedDescription],error];
}

// Create the managed object context
context = [[NSManagedObjectContext alloc] init];
[context setPersistentStoreCoordinator:psc];


I keep running into this error that it cannot find my original (old version) model. The weird thing is when I tested it during development, it worked. I released to the app store and now it is crashing on all my user's device.



Error Domain=NSCocoaErrorDomain Code=134130 "The operation couldn’t be completed. (Cocoa error 134130.)" UserInfo=0x170671dc0 {URL=file:///var/mobile/Containers/Data/Application/68165624-8866-4722-8472-F371A1202A83/Documents/DIYLandLord.data, metadata={
NSPersistenceFrameworkVersion = 519;
NSStoreModelVersionHashes = {
Contractor = <6e29455a 13768a19 a9a4a2da 1d8d492e b3cc023d bc06cb0d 298b56e1 b44fba9f>;
Expense = <847aa2e8 da0a2730 4b0a70a2 2051ed2c 09ece5c4 e1a39c10 a42f0aa2 d5b79ad4>;
InAppPurchase = <51dc7a31 415ba244 9c175d8f e14f6948 7ebec6a3 463d2995 3ad0b60b 8bd06f7d>;
Owner = <2eaaaa38 ff6c4d19 6bb2621b 91a2c61a 9f5e564e 4703c68c 880f8ab4 4e1d2408>;
Payment = <e92d19bd 82637935 88cf8493 e0c73ddc d1ba245e 0d1e49e4 8c6bc876 e9a97372>;
Property = <456365b5 9f1b3cda 92f663ef 5f8b90a1 4dc5842b 20f58a7c 4521f182 f733e99f>;
Tenant = <f3a92b85 dace78cb ae9cba8f 73419929 6932ca12 4ff97ebf 8e2d7689 da9c242b>;
Unit = <922b8c16 930cd7b7 05259da0 79ace226 bd379991 955bfc4a 755a72ef 1e5dac4c>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
""
);
NSStoreType = SQLite;
NSStoreUUID = "27CE8843-4E80-4F4A-A728-559465D687F8";
"_NSAutoVacuumLevel" = 2;
}, reason=Can't find model for source store}


I tried to revert back to the code base of the last stable release version in the app store but I also runs into a core data error "the model is not compatible with the store" or something like that.


This is driving me nut. Could someone shed some light on this issue please?




XCTest pass in isolation, fail when run with other tests

When I run a single XCTest class, all tests within succeed.


However when I run it together with other XCTest, some tests in the class fail.


setUp and tearDown method are implemented correctly as following:



- (void)setUp {
[super setUp];
...
}

- (void)tearDown {
...
[super tearDown];
}


Does anyone know why this might happen?


Thanks a bunch!




Swift throws compilation error on Fetching objects in file other than AppDelgate and accessing element in NSOrderedSet

I have a CoreDataManager.Swift where I delegated the creation of PersistentStore Coordinator, ManagedObjectContext and NSManagedObjectModel


I have the following function where Entity is a NSManagedObject and timeStamps is NSOrderedSet. In data model timeStamps is one to many relationship to another NSManagedObject TimeStamp



func fetchData(){
let fetchRequest = NSFetchRequest(entityName:"Entity")

var error: NSError?

let fetchedResults =
CoreDataManager.sharedInstance.managedObjectContext!.executeFetchRequest(fetchRequest,
error: &error) as! [NSManagedObject]?

//If error then return...

for entity in fetchedResults as! [Entity]
{
println(entity.name)
println(entity.timeStamps)
for eS in entity.timeStamps
{
println(eS.time) //OK in AppDelegate but throw compilation error in CoreDataManager.swift
// Error thrown is AnyObject does not have a member name time
//If I force to TimeStamp then the fault on timeStamps is not fired.


}
}
}


The issues is, it works fine if I have that function in AppDelegate but throws compilation errors in CoreDataManager. If I try to force it as TimeStamp then the fault on timeStamps is not fired.


Thanks for any help




Am I loading ViewController over ViewController

Hi I have a spriteKit game set up where everytime the user dies Ill get a pop up ViewController with Try again button and some iAds set up.


I have a segue to the viewController and an unwind segue from the VC to the gameViewController.


When I call the unwind func I reinitialize the scene for different reasons. My question is, am I creating view over view which will eventually lead to a crash or am I correctly reinitializing the scene. I took the code from viewDidLoad and put it into a function called "setUp()" and I call that function from the unwindSegue.


check it out: (all in GameViewController)



var currentLevel: Int!
var gameScene = GameScene()

override func viewDidLoad() {
super.viewDidLoad()

currentLevel = gameScene.currentLevel
setUp()


}
@IBAction func perpareForUnwind(unwindSegue: UIStoryboardSegue) {
setUp()
}

func setUp() {

if let scene = GameScene.level(currentLevel) {
// Configure the view.
let skView = self.view as SKView
skView.showsFPS = true
skView.showsNodeCount = true

/* Sprite Kit applies additional optimizations to improve rendering performance */
skView.ignoresSiblingOrder = true

/* Set the scale mode to scale to fit the window */
scene.scaleMode = .AspectFill

skView.presentScene(scene)

scene.viewController = self

}
}



how to fix apple80211GetInfoCopy() memory leak?

When I call apple80211GetInfoCopy() repeatedly, to track RSSI, the memory leaks.


CFDictionaryRef info = NULL; apple80211GetInfoCopy( airportHandle, &info ); // read WIFI info including RSSI from iOS




Prevent PDF file emebeded in iframe from being downloaded (in phone browsers)

I am embedding pdf files in iframe tag like this:



<iframe src="<?php echo $pdf_file['guid']; ?>" frameborder="0"></iframe>


This is working fine in desktop. But when the same page is viewed in phone (Android - Chrome, Firefox) the PDF file is not being displayed but is being downloaded automatically instead.


I want to prevent the download and allow it to be presented in ifrmae tag in phones also. How do I do that ?




iOS UICollectionView Horizontal Photo Gallery Implementation in Swift

I'm currently working on implementing a horizontally scrollable photo gallery feature. For this, I'm using UICollectionView with the flow layout set to horizontal. The problem that I'm currently facing is with the orientation. Lets say, I launched this view in landscape and i scrolled across couple of photos and now if change orientation to portrait, i'm loosing the position where i was before in the landscape mode. i want to make sure i show the same photo centered vertically that i have before changing the orientation. please find the included source code below.



class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {

var collectionView: UICollectionView!
private var samplePictures:[UIImage] = []
let CELL_IDENTIFIER = "photo_cell"
var currentIndex = 0
var flowLayout: UICollectionViewFlowLayout!


override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.

samplePictures = [UIImage(named: "Photo-1.png")!, UIImage(named: "Photo-2.png")!, UIImage(named: "Photo-3.png")!, UIImage(named: "Photo-4.png")!, UIImage(named: "Photo-5.png")!, UIImage(named: "Photo-6.png")!]

flowLayout = UICollectionViewFlowLayout()
flowLayout.scrollDirection = UICollectionViewScrollDirection.Horizontal
flowLayout.minimumInteritemSpacing = 0.0
flowLayout.minimumLineSpacing = 0.0
flowLayout.sectionInset = UIEdgeInsetsMake(0.0, 0.0, 0.0, 0.0)

collectionView = UICollectionView(frame: self.view.bounds, collectionViewLayout: flowLayout)
collectionView.delegate = self
collectionView.dataSource = self
collectionView.showsHorizontalScrollIndicator = false
collectionView.showsVerticalScrollIndicator = false
collectionView.autoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth
collectionView.pagingEnabled = true
collectionView.registerClass(SampleCollectionCell.self, forCellWithReuseIdentifier: CELL_IDENTIFIER)

self.view.addSubview(collectionView)
}

override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
collectionView.reloadData()

}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return 1
}

func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return samplePictures.count
}

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {

var cell = collectionView.dequeueReusableCellWithReuseIdentifier(
CELL_IDENTIFIER, forIndexPath: indexPath) as SampleCollectionCell

cell.backgroundColor = UIColor.brownColor()
cell.imageView_sample.image = samplePictures[indexPath.item]

return cell
}

func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
return self.view.bounds.size
}


override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
collectionView.collectionViewLayout.invalidateLayout()
}

//supports all orientations
override func supportedInterfaceOrientations() -> Int {
return Int(UIInterfaceOrientationMask.All.rawValue)
}

//view will rotate when the interface orientation happens
override func shouldAutorotate() -> Bool {
return true
}
}


This is the source code for the CustomCollectionCell that I'm using



class SampleCollectionCell: UICollectionViewCell {
var imageView_sample: UIImageView!

override init(frame: CGRect) {
super.init(frame: frame)

imageView_sample = UIImageView(frame: self.bounds)
imageView_sample.contentMode = UIViewContentMode.ScaleAspectFit
self.contentView.addSubview(imageView_sample)

}

required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func layoutSubviews() {
super.layoutSubviews()
self.imageView_surveillance.frame = self.bounds
}
}


Any help is truly appreciated. The core idea behind using this is to mimic the Photo app and also update view components when i scroll a picture. Please suggest if you think this can be done in a better way.


Regards.




Does Facebook SDK distinguish between iOS debug vs release build

Does Facebook distinguish between debug and release iOS builds? I am testing my app before submitting a new build to iTunes. My app uses the single permission of posting photo on Facebook (i.e. publish_actions). The strange thing is when I test with my Facebook account, it goes through fine. But when I test with my partner's Facebook account, it does not go through: The developer account is linked to my Facebook account; not my partner's. Basically for the following method



// Convenience method to perform some action that requires the "publish_actions" permissions.
- (void)performPublishAction:(void(^)(void))action {
// we defer request for permission to post to the moment of post, then we check for the permission
if ([FBSession.activeSession.permissions indexOfObject:@"publish_actions"] == NSNotFound) {
// if we don't already have the permission, then we request it now
NSLog(@"Requesting publish permission");
[FBSession.activeSession requestNewPublishPermissions:@[@"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
NSLog(@"Completion handler returns for permission");
NSLog(@"My Permissions are: %@",session.permissions);
if (!error) {
NSLog(@"Okay no error");
action();
} else if (error.fberrorCategory != FBErrorCategoryUserCancelled) { NSLog(@"ERROR GETTING PERMISSION:: %@",error);
}
}];
} else {
NSLog(@"the other route");
action();
}

}


action() is never called.


The line



NSLog(@"My Permissions are: %@",session.permissions);


prints



My Permissions are: (
"public_profile"
)


And the line



NSLog(@"The ERROR IS: %@",error);


prints



The ERROR IS: Error Domain=com.facebook.sdk Code=2
"The operation couldn’t be completed. com.facebook.sdk:ErrorReauthorizeFailedReasonUserCancelled" UserInfo=0x1702779c0
{com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:ErrorReauthorizeFailedReasonUserCancelled,
NSLocalizedFailureReason=com.facebook.sdk:ErrorReauthorizeFailedReasonUserCancelled,
com.facebook.sdk:ErrorSessionKey=<FBSession: 0x170169480, state: FBSessionStateOpen, loginHandler:
0x100374240, appID: 123456789, urlSchemeSuffix: ,
tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x17022a740>, expirationDate: 2015-05-19 19:07:02 +0000,
refreshDate: 2015-03-20 19:07:02 +0000, attemptedRefreshDate: 0000-12-30 00:00:00 +0000, permissions:(
"public_profile"
)>}



simulator name is shown with id instead of os name in Xcode 6.2

I've installed additional ios simulators(7.1) just after installing Xcode 6.2 and now the simulator names look like this:


enter image description here


How do I change the names?




NSInternalInconsistencyException', reason: 'Could not load NIB in bundle:

I'm trying to get Xcode's iphone simulator to display by nib after the launch screen, but I keep getting this error.


Full error:


2015-03-26 21:01:40.462 Hangman Jury[5278:476697] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'HangController''


Relevant code: in AppDelegate.m:



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = [[HangController alloc] initWithNibName:@"HangController" bundle:nil];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}


Erroring line in main.m:



return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));


HangController is a simple subclass of UIViewController


Things I've tried: -Spelling "HangController" correctly -Making sure View2.xib is included in Copy Bundle Resources -I have not renamed anything outside of Xcode -I'm not using storyboards and I have removed storyboard items from Info.plist -My view is linked to the target in the Target Membership list


Thanks for your help




iOS - Does Changing App Name Change Link?

We are preparing to submit a renamed version of our app.


We're using the SLComposeViewController to allow the user to share our app socially, and have the link to us in iTunes included:


http://ift.tt/1NjXSZJ


Will renaming the app change 'oldappname'? If so, how can we account for this when submitting the app. I'm assuming 'oldappid' will remain the same.




Transitioning to viewController from SKScene found nil when unwrapping optional value

so i found some posts about transitioning from Skscene to uiviewcontroller and I got it to work. This segue and unwind segue is called everytime the user win the level of my game or loses.


this works for level1 but as soon as I win level2 I get



fatal error: unexpectedly found nil while unwrapping an Optional value


on the line where I call the game over function below


in my game scene I have :



class GameScene: SKScene, SKPhysicsContactDelegate {

//next level / try again segue
var viewController : GameViewController!


in the GameViewController i initialize this property



var currentLevel: Int!


override func viewDidLoad() {
super.viewDidLoad()
currentLevel = gameScene.currentLevel
if let scene = GameScene.level(currentLevel) {
// Configure the view.
let skView = self.view as SKView
skView.showsFPS = true
skView.showsNodeCount = true

/* Sprite Kit applies additional optimizations to improve rendering performance */
skView.ignoresSiblingOrder = true

/* Set the scale mode to scale to fit the window */
scene.scaleMode = .AspectFill

skView.presentScene(scene)

//initialize VC
scene.viewController = self
}

func gameOver() {
performSegueWithIdentifier("gameOver", sender: nil)
}

@IBAction func perpareForUnwind(unwindSegue: UIStoryboardSegue) {

}


and finally i call gameOver from my win() function in gameScene



func newGame() {
view!.presentScene(GameScene.level(currentLevel))
}

func win() {
if (currentLevel < 3) {
currentLevel++
//present win view - with option to restart, next level, or home
}
println(currentLevel)
runAction(SKAction.sequence([SKAction.waitForDuration(2),
SKAction.runBlock(newGame)]))
self.viewController.gameOver() // this is the error!
}


So this works from level1 to level2 but wont work from level2 to level3




Apple Mach-O Linker Error - Undefined Symbols for architecture arm64

I have an issue while Running my unity project on xcode. I get over 78 Apple Mach-O Linker Errors. I have implemented a bunch of Plugins as well. However I have included all the frameworks that are required for those plugins to run.Now I am not sure why I keep getting these issues. I have attached an image of some of the Mach-o linking errors im getting. Im trying to deploy the build for iPhone 6 running 8.2 and it Xcode 6.2.


http://ift.tt/1IzUFV8


Thanks




IOS 8 get Cell info - LAC, PSC , CellId

Can somebody told me how to get Cell info - CID, LAC and PSC on ios I read about it there


but i cant understand how it work and how to insert code from there to my project




youtube in background mode in ios

I'm using http://ift.tt/1jEEGqm for implement Youtube videos in my iOS Project.


I implement the YTPlayerView object in Appdelegate; in my ViewController I execute the view. Really YTPlayerView, is a UIView that show an UIWebview.


The proble occure when I want to listen the webview (Youtube Music) in background.



- (void)applicationDidEnterBackground:(UIApplication *)application{
[self.playerView playVideo];
}


I implement this in Appdelegate but the first time I dismiss the app, the music is set in background, but the second time no and I don't know why.


I have seen so many apps at app store that u can make this, so is possible but I don't have seen anything about it.


Thanks




How to check whether user has seen push notification prompt before in iOS?

I wanted to show a message to users at the start of the app just before showing the push notification prompt. In order to determine whether I should display the message, I need to know whether user has seen the push notification prompt before.


NOTE : First I assumed, if the app is launching for the first time, users haven't seen the prompt and I used NSUserDefaults to store an indication of the the first run. But if the app is deleted and installed within the same day, push notification prompt will not be shown, even if it is the first run.




How can I test if visit monitoring is working in my iOS app? (Using startMonitoringVisits api)

I'm developing a location journaling app for iPhone, and I'm trying to use the new visit monitoring API for iOS 8. I've read the Xcode documentation and watched a WWDC 2014 Video, and I think I've properly implemented the startMonitoringVisits and didVisit methods. However, I'd like to find out if they are actually working before I build the rest of the app.


How can I find out if my app is receiving visit data? Is there a way I can use the iPhone simulator in Xcode to find out? And finally, will visit monitoring work if a user has turned off Frequent Locations in Privacy > Location Services > System Services?


I'd really appreciate it if any code examples are in Swift, as I'm more comfortable with it, but I don't want to be too demanding, so don't hesitate if you have some Objective-C examples.


Thanks.




On iphone double click is needed to enable checkbox

I'm having a hard time figuring out, why my custom checkboxes on my site needs to be clicked twice before it is actually enabled on my Iphone 4...


Any idea how to remove this behavior from iphones or is there something to be done with my code:



<input class="search-checkbox1" id="lejligheder" name="checkbox" type="checkbox">
<label class="search-labels" for="lejligheder">
Lejlighed
<div class="checkmark-wrap">
<svg class="input-check-mark1">
<use xlink:href="#checkmark-icon"></use>
</svg>
</div>
</label>

.search-checkbox1 {
display: none;
}

.search-labels {
appearance: none;
background: #272727;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #272727), color-stop(100%, #1d1d1d));
background: -webkit-linear-gradient(top, #272727 0%, #1d1d1d 100%);
background: linear-gradient(to bottom, #272727 0%, #1d1d1d 100%);
color: #fff;
text-transform: uppercase;
width: 30%;
height: 35px;
line-height: 35px;
vertical-align: middle;
padding: 0 5px 0 5px;
margin-left: 2.5%;
float: left;
font-size: 0.625rem;
border-radius: 5px;
cursor: pointer;
}

.checkmark-wrap {
width: 14px;
height: 14px;
float: right;
margin-top: 10px;
background: #38383b;
position: relative;
}

.input-check-mark1 {
width: 11px;
height: 11px;
position: absolute;
fill: #272727;
left: 2px;
top: 1px;
}


Link to test on phone: "http://ift.tt/1E5NKUI"


Cheers




Programmatic Device Specific iOS Constraint is nil

I came across an interesting problem that only arises on iPhone 6/6+ and iPad mini with retina display.


In the following code:



- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if(self.seeMoreContents)
{
BOOL isText = [self.seeMoreContents isText];
self.imageView.hidden = isText;
[self.textView removeConstraint:self.textHeightConstraint];
[self.textWrapperView removeConstraint:self.textWrapperHeightConstraint];

if (!isText)
{
__weak FCSeeMoreViewController *weakSelf = self;
[self.imageView setImageByFlashcardSide:self.seeMoreContents completion:^(BOOL preloaded){
weakSelf.imageView.center = CGPointMake(weakSelf.view.frame.size.width / 2, weakSelf.view.frame.size.height / 2);
[weakSelf.scrollView setContentOffset:CGPointMake(0, 0)];
}];
}
}
}


- (void)viewDidLayoutSubviews
{
if ([self.seeMoreContents isText])
{
self.textView.text = self.seeMoreContents.text;
self.textView.font = self.fontForContents;

self.textWrapperView.hidden = NO;
[self.textView sizeToFit];
CGFloat height = self.textView.frame.size.height;
[self updateView:self.textView withConstraint:self.textHeightConstraint ofValue:height];
[self updateView:self.textWrapperView withConstraint:self.textWrapperHeightConstraint ofValue:height + self.wrapperMargin];

[self.scrollView setContentSize:CGSizeMake(self.textView.frame.size.width, height + self.scrollTextMargin)];
[self.scrollView setContentOffset:CGPointMake(0, -self.wrapperScrollVerticalConstraint.constant)];
}
[super viewDidLayoutSubviews];
}

- (void)updateView:(UIView*)view withConstraint:(NSLayoutConstraint*)constraint ofValue:(CGFloat)value
{
constraint.constant = value;
[view addConstraint:constraint];
}


By the time the two messages of udpateView get passed, the constraints have become nil. I could attribute this to weird garbage collection behavior, but it only happens on iPhone 6/6+ and mini retina iPad.


I have changed this whole controller to work better and to not to programmatically set constraints, but I want to know how/why this can happen on specific devices. Any insight would be greatly appreciated.




Printing SecKeyRef reference using NSLog in Objective-C

I am retrieving public key from a certificate with the following code.



- (SecKeyRef) extractPublicKeyFromCertificate: (SecIdentityRef) identity {
// Get the certificate from the identity.
SecCertificateRef myReturnedCertificate = NULL;
OSStatus status = SecIdentityCopyCertificate (identity,
&myReturnedCertificate);

if (status) {
NSLog(@"SecIdentityCopyCertificate failed.\n");
return NULL;
}

SecKeyRef publickey;

SecCertificateCopyPublicKey(myReturnedCertificate, &publickey);
NSLog(@"%@", publickey);

return publickey;
}


I am trying to print the "publickey" variable to see the contents. I am getting runtime error. I would like to know how to print the contents of the "publickey" variable?




web app UIWebView not resizing after changing orientation to landscape

i'm coding an iphone app in which i have a uiwebview that loads a website with a responsive design, the problem i have is when i rotate the devices to landscap,


the uiwebview rotates but it keeps the same width as the portrait mode, i spent the last 5 hours searching all over the net, i found some solutions that i used but wihtout success,


the responsive website is http://ift.tt/1BtdQv9


the AboutViewController for loading the responsive web url:



- (void)viewDidLoad
{
[super viewDidLoad];
NSString *urlString = nil;
NSString *languageCode = [[NSLocale preferredLanguages] objectAtIndex:0];
if ([languageCode isEqualToString:@"zh-Hans"]) {
urlString = @"http://ift.tt/1EYuczg";
}if ([languageCode isEqualToString:@"zh-Hant"]) {
urlString = @"http://ift.tt/1EYuczg";
}else{
urlString = @"http://ift.tt/1E5ClEu";
}
NSURL *url = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];

NSURLRequest *urlrequest = [NSURLRequest requestWithURL:url];

[_About loadRequest:urlrequest];


}


i also checked the "Scale Page to Fit" checkbox, I'm using Xcode 6 and the app is universal and can rotate orientation


enter image description here


enter image description here




iOS App works with Local Device | How Apple store will accept it for iTunes Store

I have an application that works with our device that must be installed on local network and then application connects with the device via WIFI. I am not sure, When I will upload the application to App Store, How Apple would accept the application when they won't be able to test it.


What is the procedure in this way.


Thanks




Xcode location not allowed

I want to get the user's location in my iPhone app, but I can't because in the location settings of the iPhone, it doesn't remember my choice for "allowed location"


I hope I was clear ;p


Thanks for helping.




AppleWatch circle progress (or radial arc progress) with images error

I'm developing an app for Apple Watch using WatchKit and I need to implement a circular progress while recording audio, similar to Apple demos.


I don't know if WatchKit includes something to do it by default so I have created my own images (13 for 12 seconds [209 KB in total]) that I change with a timer.


This is my source code:


Button action to start/stop recording



- (IBAction)recordAction {
NSLogPageSize();
NSLog(@"Recording...");

if (!isRecording) {
NSLog(@"Start!");
isRecording = YES;

_timerStop = [NSTimer scheduledTimerWithTimeInterval:12.0
target:self
selector:@selector(timerDone)
userInfo:nil
repeats:NO];

_timerProgress = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(progressChange)
userInfo:nil
repeats:YES];
} else {
NSLog(@"Stop :(");
[self timerDone];
}

}


Action when timer is finished or if tap again on the button



-(void) timerDone{
NSLog(@"timerDone");
[_timerProgress invalidate];
_timerProgress = nil;
[recordButtonBackground setBackgroundImageNamed:[NSString stringWithFormat:@"ic_playing_elipse_12_%d", 12]];
counter = 0;
isRecording = NO;
}


Method to change progress



- (void)progressChange
{
counter++;
NSLog(@"%d", counter);
NSString *image = [NSString stringWithFormat:@"ic_playing_elipse_12_%d", counter];
[recordButtonBackground setBackgroundImageNamed:image];
NSLog(image);
}


This is a gif showing the bug. It starts to show but change the image randomly until it gets a pair of seconds. (Note: I have already checked that the first images have the right progress)


Screen recording that shows my bug




fetching list of teams from developer portal - time out

Trying to export an archive for Ad Hoc distribution but getting stuck with "fetching list of teams from developer portal" that times out in a minute or so and that is it.


Cannot export.


Anybody experienced that?




iOS responsive web app not follow orientation change

I am new developer, developing a hybrid iOS universal app for both iPhone and iPad, the app name is "Bellydance Festival", version 1.0. The content is loaded from responsive website and I allow app rotate orientation, it is all working fine. now I continue developing version1.1 and I didn't know what I changed and now when I rotate the view, the content is not responsive anymore. I'm sure the problem is not from website. please help. Thanks


the responsive website is http://ift.tt/1BtdQv9


enter image description here


enter image description here




iOS TabBar pushed up on keyboard appearance

I have an iOS8 app which has a UITabBarViewController as part of its master view. Embedded within that is a UITableViewController which has some UITextFields embedded in some of the cells.


When a text view is tapped, the keyboard automatically appears. If necessary, the 'view' is adjusted to allow the textView to remain showing so data can be entered.


The problem is that the tabBarController and associated tabs are also moved up. This is usually OK unless my phone is in landscape which leaves very little room to show the tableview and allow effective gestures (e.g. swiping the tableview up/down).


So, is there a way to get the keyboard to only push-up the tableview within the tabBarController, rather than the whole outer frame also being moved up? Picture below shows the problem. The device is in landscape


enter image description here




Xamarin iOS: How to connect a view from a storyboard to a controller?

I have an storyboard with a ViewController and inside the ViewController I have a UICollectionView with a prototype cell.


I already have an "MyCollectionViewController" (because I try to wrap my CollectionViewController in a ViewController). Now I want to reuse that controller but I can't figure out how to connect the CollectionView from the storyboard with a new CollectionViewController. Assigning the CollectionView from the CollectionViewController to the Outlet in the ViewController doesn't seem to work.


I know I could make the cell prototype a .xib file and create the CollectionView in code. But my employer prefers having everything in the storyboard for easier maintenance.


EDIT: The answer from chkn works great. To connect the parent view controller to the container you can override the PrepareSegue method like this.



public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender)
{
base.PrepareForSegue (segue, sender);
if (segue.SourceViewController == this) {
if (segue.DestinationViewController.GetType () == typeof(MyChildViewController)) {
MyChildViewController childViewController = segue.DestinationViewController as MyChildViewController;
}
}
}



Broadcast through UDP fail to send string packet?


NSDAta *data=[[NSData alloc]init];
udpSocket = [[GCDASsyncUDPSocket alloc]initWithDeleget:self delegateQues :dispatch_get_main_queue()];
data= [[@"HelloWorld!" dataUsingEncoding:NSUTF8StringEncoding];
[udpSocket sendData :data toHost :@"198.168.0.17" port:8080 withTimeout:-1 tag 1];



Obtaining a complete NSString from one class to another for the title of a UIButton

I have a simple application and I am now implementing In App Purchases. The layout of the problem at hand is simple:



  • I have a IAPViewController which contains the elements like a UIButton and UILabel

  • I have a e100EntriesPurchase which is what is doing the actual IAPs.


When the user clicks on an element like a UIButton in the IAPViewController, it invokes a method in the e100EntriesPurchase class which shows a UIAlertView to the user. The otherButtonTitle has a formatted text to show the price in your local country.



- (void)displayStoreUI
{
// Obtain formatted price
[self obtainPurchasePricing];

NSLog(@"HERE THE PRICE IS %@", self.productPrice);

NSString *obtainedProductPrice = self.productPrice;
NSLog(@"THE OBTAINED PRODUCT PRICE IS %@", obtainedProductPrice);

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:self.productBeingPurchased.localizedTitle message:self.productBeingPurchased.localizedDescription delegate:self.delegate cancelButtonTitle:obtainedProductPrice otherButtonTitles:@"Maybe later", nil];
alertView.tag = 999;
[alertView show];
}

- (NSString *)obtainPurchasePricing
{
// Displays Local Currency
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
formatter.formatterBehavior = NSNumberFormatterBehavior10_4;
formatter.numberStyle = NSNumberFormatterCurrencyStyle;
formatter.locale = self.productBeingPurchased.priceLocale;
self.productPrice = [NSString stringWithFormat:@"Buy this for %@", [formatter stringFromNumber:self.productBeingPurchased.price]];
NSLog(@"The price is %@", self.productPrice);
return self.productPrice;
}


All of the NSLogs are showing the price appropriately.


Now from my IAPViewController, I want the title of the UIButton to be the same as what it is set in the obtainPurchasePricing method, so:



NSString *obtainedPrice = [self.e100EntriesPurchase obtainPurchasePricing];
[self.iap100Button setTitle:obtainedPrice forState:UIControlStateNormal];
NSLog(@"The price is %@", obtainedPrice);


The problem I am facing is that the title of the UIButton is "Buy Now for (null)". The NSLog also doesn't show the actual price. This code above is in the viewDidLoad of the IAPViewController.


The properties in the e100EntriesPurchase class are:



@property (nonatomic, strong) SKProduct *productBeingPurchased;
@property (nonatomic, strong) NSString *productPrice;


What am I missing to obtain the actual price?


Any thoughts on this would really be appreciated!




Storing an image from the web for one session (in Swift)

I am following a tutorial about getting images from the web and storing them on the phone in Swift. For my purpose, I would like to know how I could only store them for one 'session', which means until the user stops using the app. The reason is that I want to change the image of the url every day. Anyone any idea?



@IBOutlet var overLay: UIImageView!

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.



let url = NSURL(string: "http://test.com")

// Update - changed url to url!

let urlRequest = NSURLRequest(URL: url!)

NSURLConnection.sendAsynchronousRequest(urlRequest, queue: NSOperationQueue.mainQueue(), completionHandler: {
response, data, error in

if error != nil {

println("There was an error")

} else {

let image = UIImage(data: data)

// self.overLay.image = image

var documentsDirectory:String?

var paths:[AnyObject] = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)

if paths.count > 0 {

documentsDirectory = paths[0] as? String

var savePath = documentsDirectory! + "/overLay.jpg"

NSFileManager.defaultManager().createFileAtPath(savePath, contents: data, attributes: nil)

self.overLay.image = UIImage(named: savePath)

}

}


})

}


thank you so much!




iOS - how to animate subviews of an expandable uitableviewcell

i expand/de-expand a tableviewcell when the user clicks on it. i do this by calling



[tableview beginUpdates];
[tableview endUpdates];


described here http://ift.tt/VpKavW this will recalculate the heights of the cells without reloading the whole tableview.


i usually layout subviews of my custom tableviewcells in



- (void)layoutSubviews {
_aTableViewCellSubView.frame = CGRectMake(0.f, 10.f, self.frame.size.width, 20.f);
...
}


my naive approach was to define a BOOL flag in the custom tableViewCell



initiallyLayedOut = NO;


and set the subviews without animation if this flag is set to NO; after inital layouting i would set it to YES, then always animate the subviews to their new positions/sizes. but this does not really work, as layoutSubviews may get called many times (in my example after resizing the cell, it's call 4 times).


i am a quite experienced iOS-developer, but i can't find a nice solution to this problem...


cheers




Objective C - iPhone/ handle subView events on ParentView

I'm having issues trying to handle the events from a Subview of my Parent View, right now I have a UIViewController that has a a subView another UIViewController, in this subView I have a paging scrollView, I want to fire a method on the parent view when I swipe the subView scroll View, do you have any suggestions on how can I develop this?, thanks




Checking property of images crashing in swift

I used this function to scan all photos from the Camera Album in iPhone/ iPad. I don't know why, for me it was crashing all the time. I really don't have any idea about where it is crashing in this function, . Sometimes it worked fine, when I changed iCloud Photo Stream to ON/OFF in Settings in iPhone/IPad. I have no idea why this happens.


This is the function which I wrote. I am passing array of PHAssets into this function.



func gettingSize(from array : NSMutableArray)
{
func enumerateAllImages(imageArray : NSMutableArray, completion : ((ArrayPassed : NSMutableArray) -> Void)?)
{

// Performing progressView addition

var TempArray : NSMutableArray = NSMutableArray()

var options : PHImageRequestOptions = PHImageRequestOptions()
options.synchronous = true
options.networkAccessAllowed = false // to skip download image from iCloud

let imageManager : PHImageManager = PHImageManager()

for index in 0...(imageArray.count - 1)
{
var ID = imageManager.requestImageDataForAsset( imageArray[index] as PHAsset, options: options, resultHandler:
{
data,stringValue,orientation,object in

var value : NSString = stringValue

if (value as NSString).containsString(".png")
{
if let isIniCloud = object as NSDictionary?
{
var isIniCloudDICT : NSDictionary = isIniCloud

if let integerCloudValue = isIniCloudDICT.valueForKeyPath(PHImageResultIsInCloudKey) as? Int
{

if integerCloudValue == 0
{
if index == (imageArray.count - 1)
{
self.tempImageSize = self.tempImageSize + data.length
TempArray.addObject(imageArray[index])
self.increasingTheValue()
completion!(ArrayPassed: TempArray)
}
else
{
self.tempImageSize = self.tempImageSize + data.length
TempArray.addObject(imageArray[index])
}

} // Checking condition for integerValueCloud
else
{
if index == (imageArray.count - 1)
{
completion!(ArrayPassed: TempArray)
}
}

} // Is in iCloud Optional checking
else
{
if index == (imageArray.count - 1)
{
completion!(ArrayPassed: TempArray)
}
}

} // Is in iCloud NSDictionary optional checking
else
{
if index == (imageArray.count - 1)
{
completion!(ArrayPassed: TempArray)
}
}
}
else
{
if index == (imageArray.count - 1)
{
completion!(ArrayPassed: TempArray)
}
}
}) // Image Manager
} // For loop
} // Nested Function

enumerateAllImages( array, { ArrayPassed in

if ArrayPassed.count == 0
{
dispatch_async(dispatch_get_main_queue(), {

self.progressView.progress = 0
self.tempProgress = 0
self.increasingTheValue()
})
}
else
{
self.Array = ArrayPassed
}
})
}


Does anybody knows why this happens, when I run it, it crashes? Crahes on this line



var value : NSString = stringValue


Multiple times, no idea why this happens.?




How to know the command of Siri about HomeKiit in iOS?

I am new to HomeKit , and I got a demo board which it can work with iPhone.


When I turn on the demo borad , I can see the Accessories in Setting -> WiFi . I click the Accessories and add the Accessories to the WiFi Network. The Accessories and the iPhone are in the same WiFi Network.


I turn on Siri and say "Turn On the Light" , the LED on the demo board will turn on.


But it should has other command to control the light for adjust light levels up or down.


How do I know the all command of Siri about HomeKit in iOS ?


Thanks in advance.




Determine if an iOS device supports TouchID without setting passcode

I'm currently developing an iOS app that enables users to log in to the app using TouchID, but firstly they must set up a password inside the app first. Problem is, to show the setup password option to enable the TouchID login, I need to detect if the iOS device supports TouchID.


Using the LAContext and canEvaluatePolicy (like the answers in here If Device Supports Touch ID), I am able to determine whether the current device supports TouchID if the user has set up passcode on their iOS device. Here is a my code snippet (I'm using Xamarin, so it's in C#):



static bool DeviceSupportsTouchID ()
{
if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
{
var context = new LAContext();
NSError authError;
bool touchIDSetOnDevice = context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out authError);

return (touchIDSetOnDevice || (LAStatus) Convert.ToInt16(authError.Code) != LAStatus.TouchIDNotAvailable);
}

return false;
}


If the user has not set up the device passcode, the authError will just return "PasscodeNotSet" error regardless of whether the device actually supports TouchID or not.


If the user's device supports TouchID, I want to always show the TouchID option in my app regardless of whether the user has set up passcode on their device (I will just warn the user to setup passcode on their device first). Vice versa, if the user's device doesn't support TouchID, I obviously don't want to show the TouchID option in my app.


So my question is, is there a nice way to consistently determine whether an iOS device supports TouchID regardless of whether the user has set up passcode on their device?


The only workaround I can think of is to determine the architecture of the device (which is answered in Determine if iOS device is 32- or 64-bit), as TouchID is only supported on devices with 64-bit architecture. However, I'm looking if there's any nicer way to do this.


Thanks beforehand! :)




Simple timer showing hours,minutes,seconds in xamarin iOS

I am new in ios development and working on ios in xamarin.


Can anyone please tell me the code to write in xamarin ios for timer , in which i ll get hours , minutes and seconds .


Any answer will be helpful thanks.




Why does iOS have a ‘bounce-back’ effect when reaching the end of a list? Give an example of alternative implementations and they might be used

I search everywhere for this question.. Hope Stackoverflowers will help..."Why does iOS have a ‘bounce-back’ effect when reaching the end of a list?"




Create a Dictionary iOS App

I want to create a dictionary app for iPhone. So anybody can suggest that how to create it in best way? Is already exists some API that contains all Dictionary words? How to store all dictionary words in somewhere may be Database or JSON/XML file? Please suggest




MKCircleRenderer fillcolour overlap issue

I am adding MKCircleRenderer to a map code for that is



- (MKOverlayRenderer*)mapView:(MKMapView*)mapView rendererForOverlay:(id <MKOverlay>)overlay
{
MKCircle* circle = overlay;
MKCircleRenderer *circleView = [[MKCircleRenderer alloc] initWithOverlay:circle];
circleView.fillColor = [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.1];
return circleView;

}


Here the issues is that when two circles overlap i do not want them to get "mixed" and display a darker color in the overlapping area as like this.


enter image description here


Can any one please advise any hint / solution to resolve this.




Sending messages from parent app to WatchKit Interface

I can send a message from my WatchKit Interface to its parent application using +openParentApplication:reply:. Is there an official Apple mechanism for sending a message in the other direction, or do I have to use a library like MMWormhole?




Potential Loss of Keychain Access Issue After Application Move Account A To B in iOS

Our iOS app is transfer from Account A to B, Earlier we had used the certificates which was created in Account A and upload a build on iTunes Connect using certificates of Account A.


Now when we uploading app on iTunesconenct for Beta Testing that time we have used the certificates which was created in Account B(Due to Transfer App Account).


So, Now application identifier of the live app is different from the application identifier of the Beta TestFlight Testing App on App Store. And we have got the warning potential loss of keychain access.


Right Now, We are using SSKeychain Wrapper for Store UUID to track user. [SSKeychain setPassword:UUID forService:@"com.example.appname” account:@“appname” error:&error]


If App ID Prefix changed then SSKeychain loss it’s access?


Because We track UUID in database for further use using SSKeychain. My doubt is if APPID Prefix changed then it is also effect the SSKeychain and it is generate new UUID for all devices?


So, How we can solve this issue ? Please let us know about solutions of this issue.




Navigation Bar color change

I am using Xcode 4.5.2 when setting navigation bar color using tint color property .now navigation bar color has the white shadow above my navigation bar color




Ways to Decompile an ipa File

Is it possible to decompile/disassemle .ipa file to obtain some useful information like some source code or any other useful Information from the file




Error Domain=Parse Code=209 "The operation couldn’t be completed

I installed the ParseStarterProject swift version and created a new user with the following code:



var user = PFUser()
...
user.signUpInBackgroundWithBlock...


Then I ran the project again without doing anything I get the following errors:


2015-03-26 09:49:25.485 ParseStarterProject[14768:199520] [Error]: invalid session token (Code: 209, Version: 1.7.0) 2015-03-26 09:49:25.489 ParseStarterProject[14768:199521] [Error]: Failed to run command eventually with error: Error Domain=Parse Code=209 "The operation couldn’t be completed. (Parse error 209.)" UserInfo=0x7fcda3cb6680 {error=invalid session token, code=209}


what have I done wrong??




Excluding files from the release bundle using a script

I have some files that I need when the application is in develop mode but want to exclude on the release version.


I have added this script to the build phase



if [ ${CONFIGURATION} == "Release" ]; then
rm -rf ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/CORE_DATA_IMAGE/
fi


CORE_DATA_IMAGE is a directory that contains a lot of images that I don't want on the release version.


This script is doing exactly nothing. The images continue to be included on the final release version.


Any ideas?




Custom font not Showing

enter image description hereI want to add custom font in my application . I am adding in my project. and then adding in .plist file. i am adding plist


and my code is



UIFont *CiutadellaBold = [UIFont fontWithName:@"Light up the World with accented characters" size:90.0f];
// Do any additional setup after loading the view, typically from a nib.
[label setFont:CiutadellaBold];
label.text =@"hello";


But they shown my text in custom font. Please help




mercredi 25 mars 2015

Will an iOS app with radio buttons be rejected from the app store

If i were to write a custom renderer for a radio button control, for iOS, could it be rejected from the App Store since radio buttons aren't native controls?


An example radio button control for iOS / Android / WindowsPhone (written in Xamarin) can be view here http://ift.tt/1CQIQtn


Regards




ViewDidAppear not called when the modal view is dismissed

First, I create a MainViewController. Then in MainViewController, I do



[self presentViewController:modalViewController animated:YES completion:nil];
modalViewController.modalPresentationStyle = UIModalPresentationFormSheet;


When I dismiss the modalViewController, On iPhones(except iPhone 6+), viewDidAppear of MainViewController is called. On iPads and iPhone 6+, viewDidAppear of MainViewController is not called.


The logic is to called a function when the modalViewController is dismissed. How can I know when the modalViewController is dismissed.




change MKMapView's frame and center coordinate together smoothly in an animation

my code like this:


[UIView animateWithDuration:.3f animations:^{


mapView_.frame = CGRectMake(0,0, superView.frame.size.width, superView.frame.size.height);


MapAnnotation *ann = [baseAnn_ objectAtIndex:0];


[mapView_ setCenterCoordinate:ann.coordinate animated:NO];


}];


before animation the annotation is below the center of the mapView_, I want to change the mapView_'s frame while move the annotation to the center of the mapView_.


but the moving is not smooth, the annotation first move while the frame changing to a position still below the center, then move up to the center.


is there a way to make the annotation move direct to the final position, not first below is then move up?




No Enough Cell to Use in UITableview

I have create a UITableview in Storyboard and it is dynamically cell. The problem is that when there is no enough cells to reuse, it randomly empty few of my cells. I think this is logic, but i want to resolve this problem.


I give an example: I have a tableview that is capable to generate 10 cells in a view. But now, i only want to show 8 cells out of 10. It gives no problem when i have only a section. With more than 1 section, it will always empty 2 cells and show 8 cells, but it should show 10 cells.


Can anyone help me with this. Thank you.




How to protect my database in IOS application (Best way)

I'm using SQLite database in my application and I need to protect the SQLite file. What's the best way to protect it?



  1. Password protected?

  2. DB Encryption?




How to Support All iPhone Screen Sizes

I have an app in Xcode 6.2 with the storyboard supporting all devices. For some reason, whenever I load the application on the iPhone 6+, or iPhone 4s, or iPad, the screen doesn't take the size of the iPhone/iPad. However, on an iPhone 6, 5s, and 5, the screen takes the full size of the iPhone. Why is this? I am very unfamiliar with sizes and how to properly support all sizes. Right now, I have set the screen sizes in the storyboard for each view controller to 320 x 568. The width is "Compact" and the height is "Any".


If this has anything to do with this, my iPad screen comes out blank. It's just white. Apple recently rejected my external testers app submission due to this.


I have done lots of research on these 2 questions, but I had a hard time understanding anything, as I am new to iOS Development.




Implementing Ads on tableviewcell in iphone

I am trying to implement Ads on tableviewcell in iphone for my latest project.I browse a lot on the this topic and found that apple will reject the app if the ads is placed in a floating mode ie in tableviewcell.So i go through the mopub third party and implemented this,if the app will get reject if i use the same or is their any other options to implements this in iphone.


Thanks in advance.




LaunchScreen and Storyboard in Xcode

I am New to IPhone Development.I am Creating a sample app to just know how to make Iphone apps. I came across Launch screen and Storyboard in the project Description, But was not able to understand what is the role of launch screen and Storyboard.Can anyone plz explain briefly about both. Can i Delete LaunchScreen.xib from my project.?




App crashes when table cell is tapped

I am using the LeveyPopListView. Inside the LeveyPopList View is a table containing jobs in a specific company. All is fine until I tap a job in the pop up list view and I've checked everything. Here's my code:



NSArray* ar_filter=(NSArray*)[self.FilterDictionary objectForKey:@"sub_slots"];
NSInteger numberOfJobs = [[[[[self.FilterDictionary objectForKey:@"sub_slots"] valueForKey:@"company_group"] valueForKey:@"job_count"] objectAtIndex:[self.jobsTableView indexPathForSelectedRow].row] intValue];
NSLog(@"NUMBER OF JOBS: %ld", (long)numberOfJobs);
NSLog(@"ARRAY FILTER: %@", ar_filter);

//MARK: for consolidated view
if([[ar_filter objectAtIndex:[self.jobsTableView indexPathForSelectedRow].row] objectForKey:@"company_group"])
{
if(numberOfJobs > 1)
{
NSString *company_id = [[[[self.FilterDictionary objectForKey:@"sub_slots"] valueForKey:@"company_group"] valueForKey:@"company_id"] objectAtIndex:[self.jobsTableView indexPathForSelectedRow].row];
NSString *company_name = [[[[self.FilterDictionary objectForKey:@"sub_slots"] valueForKey:@"company_group"] valueForKey:@"company_name"] objectAtIndex:[self.jobsTableView indexPathForSelectedRow].row];
NSDictionary *specificCompany = [NSDictionary dictionaryWithObjectsAndKeys:company_id,@"company_id", nil];

if(specificCompany.count>0)
{
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:specificCompany
options:0
error:&error];

if (! jsonData)
{
NSLog(@"Got an error: %@", error);
}
else
{
strJsonStringFilter = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
}

allJobsDictionary = [NSJSONSerialization JSONObjectWithData:[network getData:[NSString stringWithFormat:@"get_all_job_offers?pt_id=%@&filter=%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"pt_id"], strJsonStringFilter]] options:kNilOptions error:nil];
//this contains the jobs that are given by allJobsDictionary
jobsToDisplay=(NSArray*)[allJobsDictionary objectForKey:@"sub_slots"];
//call LeveyPopListView
LeveyPopListView *lplv = [[LeveyPopListView alloc] initWithTitle:company_name options:jobsToDisplay handler:^(NSInteger anIndex)
{
}];

lplv.delegate = self;
[lplv showInView:self.view animated:YES];
strJsonStringFilter = @"";
}
}

- (void)leveyPopListView:(LeveyPopListView *)popListView didSelectedIndex:(NSInteger)anIndex {
NSDictionary *job = (NSDictionary*)[jobsToDisplay objectAtIndex:anIndex];

// Pass data and transit to detail job view controller
[self.parentViewController performSelector:@selector(showJobDetailWith:) withObject:job];
}

-(void)showJobDetailWith:(NSDictionary *)dictionary {
// Pass data to global variable for prepareForSegue method
mapPinSelectedDictionary = dictionary;

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

MTJobDetailTableViewController *smsController=[storyboard instantiateViewControllerWithIdentifier:@"MTJobDetailTableViewController"];

[smsController setJobDetailDict:mapPinSelectedDictionary];
[self.navigationController pushViewController:smsController animated:YES];
}


from LeveyPopListVIew.m



- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:YES];

// tell the delegate the selection
if ([_delegate respondsToSelector:@selector(leveyPopListView:didSelectedIndex:)])
[_delegate leveyPopListView:self didSelectedIndex:[indexPath row]];

if (_handlerBlock)
_handlerBlock(indexPath.row);

// dismiss self
[self fadeOut];
}


The app crashes when this line of code [self.parentViewController performSelector:@selector(showJobDetailWith:) withObject:job]; is called. Can anyone help me this. Thank you.




objective c - dismiss uitabbarviewcontroller

I have implemented a simple login page, where the user logs in with valid credentials. I then set the NSUserDefauts and navigate them to the "HOME" screen. I'm now trying to implement a logout button.


Below is how return back to the login screen and clear my NSUserDefaults.



NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];

[self dismissViewControllerAnimated:YES completion:nil];


Is this the correct way to implement a 'logout' functionality? I just want to make sure I implement the functionality correctly and not cause any memory leaks.




Having issue with media query for iPhone Plus

I'm pulling my hair with this issue. I have set the following for my iPhone 6+ media query.


iPhone 6+


@media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 3)


For Samsung Galaxy S4


@media only screen and (min-device-width: 320px) and (max-device-width: 640px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 3)


The issue I'm having now is that the browser is not recognizing the iPhone 6+ media query but choose to use the Samsung Galaxy S4 media query when I test them with Chrome device emulator.


I'm not having problem with the rest except for the iPhone 6+. Anyone has any idea what I'm missing here?


If I add !important to my css only than the iPhone 6+ media query will be recognized and used. But it is kind of crazy to have !important for every classes in iPhone 6+ media query.




Static And Dynamic Table View In Xcode

I want it to implement a table view that works like a drop down menu or a limited expandable table view. An example of functionality would be like this:


Each main cell has a food category, Italian, Chinese, Thai, etc. The cell has a label (Italian) with a number right next to it like this: Italian (5), meaning that there are 5 Italian restaurants in your area (you're downtown or something). The cell will also have an accessory view pointing downward. When you tap the cell, the accessory view will point upward and a table view will be displayed below that cell (and above the next main cell "Chinese"). The table view displayed will show each restaurant (one in each cell) of that kind in your area; it will be like 150-200 pixels in height, and I need to be able to scroll through it. When I'm done scrolling through and looking at the restaurants, I can tap the main cell, "Italian (5)", and the view will disappear with the accessory view pointing down again.


Side question: Should the parent table view be dynamic because of this considering that the number of restaurants in each category would change whenever the table view is visited or refreshed?


My main question is this: How would I go about implementing this? I tried an expandable table view using some code from GitHub, but the problem with that is this method is only adding cells to the table. ALL the cells (restaurants) are displayed, thus pushing the main cells further downward. I need to display a table view that has a fixed height that a user can scroll through. Would I have to use something like a container view after each main cell, have it hidden, and only appear when the main cell is clicked? The only thing that's keeping me from trying this is that I do not know how to programmatically make a view (ex. container view) appear or be inserted after the main cell has been tapped and have it disappear after the main cell has been tapped again. Should I put the code to do that in this function of the table view controller?



(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath


On the other hand, I do not want to overcomplicate it if there is a simpler solution, so any advice on what the best method would be, would be greatly appreciated, thanks!




UITableView not showing left-side multiple selection circles on edit

I am trying to get the standard multiple selection behavior for UITableView as in the system Mail.app and Messages.app when edit is pressed in the inboxes. I am setting allowsMultipleSelectionDuringEditing to YES, and am calling [self.tableView setEditing:YES animated:YES] when my edit button is pressed. However, everything remains still and the open circles do not emerge from the left side of the cell as I want them to. I am not setting any of the UITableViewCells' accessoryType or calling setEditing on any of them as it is.


Is there anything I am missing, or something further that I have to do? To be clear, I am looking for the left-side multiple selection functionality, not the floating checkmarks that might appear on the right side of the cell. Thanks




Is there support in Cordova to WKWebView?

I would like to know if is possible use WKWebView with cordova. And if this is possible, how I can use.


I read that cordova 4.0 maybe will use WKWebView, but I can't find if this is in production.


Thanks in advanced




UIScrollview is not scrolling beyond UIView height even though UIView frame is increased

I am trying to create a screen where scrolling is required in iphone 3.5 inch screen . I have attached images which contain the configuration of uiviewcontroller , uiscrollview , uiview . The problem is eventhough the height seems to increase , when i run iPhone 4s , some part of scroll is hidden beyond the UIView (Although uiview height shows 700 when i print the height in console) . What might be the problem ? Please help me ?enter image description here


enter image description here


enter image description here


enter image description here