ios,tabs,crash,launch,symbolicate , Crash at launch - ios 8.1 because adding UIButton's subview. EXC_BREAKPOINT (SIGTRAP)


Crash at launch - ios 8.1 because adding UIButton's subview. EXC_BREAKPOINT (SIGTRAP)

Question:

Tag: ios,tabs,crash,launch,symbolicate

I have just got rejected by Apple with the following reason:

We were unable to review your app, as it crashed on launch on the following device(s): - iPhone 5S running iOS 8.1- iPhone 6 running iOS 8.1- iPhone 6 Plus running iOS 8.1

Here is what I did:

I did test it with the devices in simulator ios 8.1,8.2. I also tested it with read devices: iphone 4 running ios 7.1, ipad running ios 8.3. There were no crash at all.

With the crash log that they sent, I use Symbolicator to generated the following symbolicated log:

Process:             Meety [1125]
Path:                /private/var/mobile/Containers/Bundle/Application/12CA9A59-184C-4B7E-9D2A-0B4703363AA2/Meety.app/Meety
Identifier:          com.cungcode.Meety
Version:             1 (1.0)
Code Type:           ARM-64 (Native)
Parent Process:      launchd.development [1]

Date/Time:           2015-05-16 05:34:46.952 -0700
Launch Time:         2015-05-16 05:34:46.165 -0700
OS Version:          iOS 8.1 (12B411)
UDID:                d1c1574d0e021ab0d30ce26e69978227c7080d3c
Report Version:      105

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000010016bdf8
Triggered by Thread:  0

Filtered syslog:
2015-05-16 05:34:46.535 Meety[1125]: <Error> assertion failed: 12B411: libxpc.dylib + 71820 [AD580443-238D-3997-8D09-004C210D0C18]: 0x7d

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
__TFC5Meety20MainTabBarController24addCenterButtonWithImagefS0_FTCSo7UIImage14highlightImageGSqS1___T_ MainTabBarController.swift:227
__TFC5Meety20MainTabBarController11viewDidLoadfS0_FT_T_ MainTabBarController.swift:57
2   UIKit                           0x000000018a72ce80 0x18a71c000 + 69248
3   UIKit                           0x000000018a72cb90 0x18a71c000 + 68496
4   UIKit                           0x000000018a733258 0x18a71c000 + 94808
5   UIKit                           0x000000018a7309d8 0x18a71c000 + 84440
6   UIKit                           0x000000018a7a1a00 0x18a71c000 + 547328
7   UIKit                           0x000000018a9b5434 0x18a71c000 + 2724916
8   UIKit                           0x000000018a9b79ac 0x18a71c000 + 2734508
9   UIKit                           0x000000018a9b6044 0x18a71c000 + 2728004
10  FrontBoardServices              0x000000018e2c163c 0x18e2a8000 + 103996
11  CoreFoundation                  0x0000000185f36120 0x185e58000 + 909600
12  CoreFoundation                  0x0000000185f35228 0x185e58000 + 905768
13  CoreFoundation                  0x0000000185f3384c 0x185e58000 + 899148
14  CoreFoundation                  0x0000000185e611f0 0x185e58000 + 37360
15  UIKit                           0x000000018a797788 0x18a71c000 + 505736
16  UIKit                           0x000000018a792780 0x18a71c000 + 485248
_main AppDelegate.swift:16
18  libdyld.dylib                   0x0000000196dc6a04 0x196dc4000 + 10756

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x0000000196ec4c94 0x196ec4000 + 3220
1   libdispatch.dylib               0x0000000196dac97c 0x196d9c000 + 67964
2   libdispatch.dylib               0x0000000196d9f3b0 0x196d9c000 + 13232

Thread 2:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 3:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 4:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 5:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 6:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 7:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 8:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000196f71958   x2: 0x000000015fd233e0   x3: 0x000000000000001e
    x4: 0x0000000000000010   x5: 0x0000000000000001   x6: 0x0000000000000000   x7: 0x0000000000000000
    x8: 0x0000000000000000   x9: 0x000000015fe0c850  x10: 0x0000000000000000  x11: 0x000000000000005e
   x12: 0x0000000000000001  x13: 0x000000000017a17c  x14: 0x0000000000000015  x15: 0x0000000000000000
   x16: 0x0000000100a8217c  x17: 0x0000000000000000  x18: 0x0000000000000000  x19: 0x00000001740995a0
   x20: 0x00000001700997d0  x21: 0x000000015fe0c850  x22: 0x0000000000000000  x23: 0x000000015fd233e0
   x24: 0x0000000100ab30c8  x25: 0x0000000100856dd0  x26: 0x0000000100856dd0  x27: 0x000000019aa4a0a8
   x28: 0x0000000000000001  fp: 0x000000016fd1e160   lr: 0x000000010016b8c0
    sp: 0x000000016fd1e100   pc: 0x000000010016bdf8 cpsr: 0x80000000

So it appears to me that the bugs must be in the following code:

(In MainTabBarController)

@IBOutlet weak var mapButton: UIButton!

override func viewDidLoad()
{

    super.viewDidLoad()
    self.delegate = self
    var middleImage:UIImage = UIImage(named:"MapButton")!
    var highlightedMiddleImage:UIImage = UIImage(named:"MapButtonHighlighted")!
    addCenterButtonWithImage(middleImage, highlightImage: highlightedMiddleImage) //Line 57 --> Correct!!
    self.tabBar.barTintColor = UIColor.blackColor()

}

func addCenterButtonWithImage(buttonImage: UIImage, highlightImage:UIImage?)
{
    mapButton = UIButton.buttonWithType(UIButtonType.Custom) as UIButton //UPDATE 1: LINE 206 --> CRASH HERE 
    mapButton.autoresizingMask = UIViewAutoresizing.FlexibleBottomMargin|UIViewAutoresizing.FlexibleLeftMargin|UIViewAutoresizing.FlexibleRightMargin|UIViewAutoresizing.FlexibleTopMargin

    mapButton.frame = CGRectMake(0.0, 0.0, buttonImage.size.width, buttonImage.size.height);
    mapButton.setBackgroundImage(buttonImage, forState: UIControlState.Normal)
    mapButton.setBackgroundImage(highlightImage, forState: UIControlState.Highlighted)
    //Center the button on tabbar        
    var heightDifference:CGFloat = buttonImage.size.height - self.tabBar.frame.size.height;

    if heightDifference < 0 {
        mapButton.center = self.tabBar.center;
    }
    else
    {
        var center:CGPoint = self.tabBar.center;
        center.y = center.y - heightDifference/2.0;
        mapButton.center = center;
    }

    mapButton.addTarget(self, action: "changeSelectedTabToMapTabController:", forControlEvents: UIControlEvents.TouchUpInside)

    self.view.addSubview(mapButton)
} //LINE 227: PROBABLY CRASH HERE, BUT I THINK IT CRASH ON LINE 206

The meaning of the above code is that, I want to create an Instagram-like tab bar. So I add a button in front of the 3 tab in a 5-item tab bar. In the simulator ios 8.1 it looks like below:

enter image description here

1) The code was simple and I cannot find out why it crash in ios 8.1. Right now I do not have a real device running ios 8.1 to test it so I'm asking if you could find abnormal things in the code.

2) Is it possible that the app crash because of something wrong with provisioning profile? But I think it is not my case because I archive with distribution profile, and install the ipa via iTunes and TestFlight to my ipad that it can run ok.

Sorry for very long question. Any help would be much appreciated!

UPDATE 1: I symbolicate by command line to confirm again about the crash, as described by Sea Coast of Tibet's answer in here. Then I got the crash must be in line 206 of the code:

mapButton = UIButton.buttonWithType(UIButtonType.Custom) as UIButton

There must be something wrong with this kind of initiation. I don't use Storyboard for this button, but I create programmatically. My friend who uses XCode 6.3 (I'm using 6.2), when opening my project sees a lot of compile error relating to "as", "!" and "?". I think I'm going to update my XCode to 6.3 to see if I have compile error with "as" in line 206.


Answer:

Finally I managed to get a real device for testing. It crashed at the following line:

mapButton.autoresizingMask = UIViewAutoresizing.FlexibleBottomMargin|UIViewAutoresizing.FlexibleLeftMargin|UIViewAutoresizing.FlexibleRightMargin|UIViewAutoresizing.FlexibleTopMargin

Reason: mapButton is nil. It is so strange because this line is right above:

mapButton = UIButton.buttonWithType(UIButtonType.Custom) as UIButton

So in face this initialiser do not initialise my button. So I might agree with Chandan005 about the compiler issue. I change the code to:

   let frame = CGRectMake(0.0, 0.0, buttonImage.size.width, buttonImage.size.height)
    button = UIButton(frame: frame)

Now it works on iPhone 6, ios 8.1. I have submitted my app again, hopefully it will pass this time. I wrote about this bug here in my blog.


Related:


Adding Image And title both to UIsegmentControl IOS


ios,uiimage,title,uisegmentedcontrol
Is there a way so that you can set both image and title of UISegmentControl simultaneously, so that image appear next to the title , just like image appear next to title in UIButton. I am trying but if I set image of Selected segment of UISegmentControl then title disappears...

iOS: Go back to entry point view controller which is not part of navigation controller


ios,uinavigationcontroller,swrevealviewcontroller
I have a login view controller which is outside my navigation controller. When a user logs out, I want them to be back to the login view controller. I am using SWRevealViewController and Storyboards. User Flow: -> Login View Controller -> SWRevealViewController-> UINavigationController...

How to get time difference based on GMT on Swift


ios,swift
I am trying to get a time difference based on a GMT time. where at the end of everyday the timer resets to zero. I've tried the below code on the Xcode simulator and every time i change the time on the mac, the difference also changes. how can i...

PFUser not unwrapped - swift


ios,xcode,swift
I'm beginning to learn swift with parse and i've run into this error: "Value of optional type 'PFUser?' not unwrapped; did you mean to use '!' or '?' I can't seem to get it to work... PFFacebookUtils.logInWithPermissions(["public_profile", "user_about_me", "user_birthday"], block: { user, error in if user == nil { println("the...

Override UITabBarController Icon Selection


ios,objective-c,uitabbarcontroller
I'm using a standard UITabBarController with icons at the bottom, each bringing to it's ownViewController. My question is basically: Is there a way to override what happens when an icon is selected rather then directly bringing them to the view? Reason being is because I'm adding a login screen to...

How can I fix crash when tap to select row after scrolling the tableview?


ios,xcode,swift,uitableview,tableviewcell
I have a table view like this: when the user tap one row, I want uncheck the last row and check the selected row. So I wrote my code like this: (for example my lastselected = 0) func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { var lastIndexPath:NSIndexPath = NSIndexPath(forRow: lastSelected, inSection:...

Obj-C Instance method returning a instanceType called from Swift - Function produces expected type 'UIImage!' error


ios,objective-c,swift
I have this instance method in an existing Obj-C UIImage category: - (UIImage *)applyDarkEffect; I'm trying to call it from a Swift file like so: self.backgroundImageView.image = UIImage.applyDarkEffect(image) But get this compiler error: Function produces expected type 'UIImage!'; did you mean to call it with '()'? ...

Characters and Strings in Swift


ios,string,swift,unicode,character
Reading the documentation and this answer, I see that I can initialize a Unicode character in either of the following ways: let narrowNonBreakingSpace: Character = "\u{202f}" let narrowNonBreakingSpace = "\u{202f}" As I understand, the second one would actually be a String. And unlike Java, both of them use double quotes...

What is the best practice add video background view?


ios,objective-c,swift,video
I want to add background view with video (or gif) like in app "Uber" I'd like to use video background view for a long time in my app. And I want to know the answers to these questions: What of them will consume less battery energy Can I use it...

IOS - Adjust cell height based on content


ios,uitableview,autolayout
im trying to build apps that have tableview cell similiar with twitter, there are text and images. My problem is i want to insert the image above the text. While it can be text only. So if there are no image, the text will be in position (0,0). And if...

UITapGestureRecognizer sender is the gesture, not the ui object


ios,xcode,swift,uigesturerecognizer
I've got a button called and I gave it a UIGestureRecognizer so that an IBAction is only run when the button is long pressed. You do this by adding a UILongPressGestureRecognizer to the button iteself. Then you control drag that gesture recognizer to a function like this: @IBAction func handleGesture(sender:...

Extra table cells when UITableViewController is embedded into a Container in a UIViewController


ios,swift,uitableview,uiviewcontroller
In order to customize a table view and add some additional controls to it, I've embedded a UTTableViewController into a Container View and placed that container View into a UIViewController. I've followed the instructions I found here: Embedding TableView in TableViewController into another view TableView is configured with four static...

How to create UITableViewCells with complex content in order to keep scrolling fluent


ios,swift,uitableview,cocoa-touch,ios-charts
I am working on a project where I have a table view which contains a number of cells with pretty complex content. It will be between usually not more than two, but in exceptions up to - lets say - 30 of them. Each of these complex cells contain a...

Slide in an UIButton and push other UIButton when a certain distance is reached


ios,objective-c,uiviewanimation,nslayoutconstraint
I would like to slide in a UIButton (grey color in screenshot) from the left to right and center it on the screen. There is an UIButton (orange color in screenshot) already though that is centered and this button should be pushed to the right and always have a distance...

App crashes when i start typing in uiseachbar in uitableview


ios
I am making a project in which i am fetching addressbook in my tableview with the help of NSObject class. Now , I allocated a UISearchbar in it , but when i start typing , the app crashes with the following error :---- 'Can't use in/contains operator with collection (not...

Transferring an Xcode project to another computer with all files/frameworks


ios,xcode,frameworks,transfer,projects
I am trying to copy over my Xcode project from one computer to another but it seems to lose frameworks and the locations for the images although i copied those too. PS I am using xcode and coding an app with a friend. Is there a useful source that can...

How can I show ONLY the date (and not the time) using NSDateFormatter?


ios,iphone,swift
I think the question is pretty straightforward. I need only the date to appear, and not the time. Couldn't find anything for Swift, so my code is here: cell.date.text = NSDateFormatter.localizedStringFromDate(dates[indexPath.row], dateStyle: .ShortStyle, timeStyle: .ShortStyle) ...

Getting video from Asset Catalog using On Demand ressources


ios,xcode,xcode7,ios9,asset-catalog
I attributed to my .mp4 video the "tokyo" tag for example, and set it as installed during the app installation. Now before I was using a Path to get it from my resources, now it's different because it's located on the Asset Catalog. After found documentations, I tried something like...

Change background color of viewcontroller but not top area with clock


ios,user-interface,uiviewcontroller
I want to make my whole ViewController grey except I want the top area where it shows CARRIER and the current time to remain white. Is the only way just to stick a View that covers everything except that area, and set it to grey, or is there some way...

ios8 Timezone parsing changed?


ios,nsdateformatter
Has the parsing for timzones changed in iOS8? I try to parse the date "2014-09-03 12:20:38.000 +0200" with this code and get nil: -(NSDateFormatter*) dateAndTimeFormatter{ if(!_dateAndTimeFormatter){ _dateAndTimeFormatter = [[NSDateFormatter alloc]init]; [_dateAndTimeFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss.SSS ZZZZZ"]; _dateAndTimeFormatter.dateStyle = NSDateFormatterShortStyle; _dateAndTimeFormatter.timeStyle = NSDateFormatterShortStyle; } return _dateAndTimeFormatter; } alternatively [_dateAndTimeFormatter setDateFormat:@"yyyy-MM-dd...

It is possible to continuously update the UILabel text as user enter value in UITextField in iOS


ios,objective-c,swift,uitextfield,uilabel
In my application i have one UILabel and UITextField. Initially UILabel text in nil. As soon as user enter some text in UITextField my UILabel text also Update. Let say When user enter A in UITextField my UILabel immediately show A, B in UITextField my UILabel show B and so...

Difference between stringByAppendingString and appendString in ios


ios,objective-c,swift,nsstring,nsmutablestring
What is the difference between stringByAppendingString and appendString? If NSString is not mutable then how could it append string?

NSString to NSDate doesn't work


ios,objective-c,nsdateformatter
now it works with this code: NSString *myDate = @"06/18/2015 8:26:17 AM"; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"MM/dd/yyyy hh:mm:ss a"]; [dateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US"]]; NSDate *date = [dateFormatter dateFromString:myDate]; [dateFormatter setDateFormat:@"dd.MM. HH:mm"]; NSString *dateString = [dateFormatter stringFromDate:date]; cell.timeLabel.text = dateString; ...

How to draw each a vertex of a mesh as a circle


ios,unity3d,shader,mesh,particle
How to draw each a vertex of a mesh as a circle?

Set color CFAttributedStringRef


ios,objective-c
I have this methods for draw a table ant populated . What i want is to change the color for one word from each column , but i dont know how can i do it . Can somebeday help me ,please ? Any help will be appreciate . in my...

SpriteKit collision angle of line and circle is odd


ios,sprite-kit,skphysicsbody
Suppose a circle is enclosed in a diamond, and the circle heads due right. I would expect a series of continual 90 degree angles as the circle draws a square within the diamond. What I'm seeing, however, is that the circle eventually gets pushed toward the center of the diamond...

Is it possible to obtain an unique iCloud user ID on cocoa?


ios,iphone,cocoa,ipad,icloud
My iOS app is currently on beta in TestFlight, and as a way to retribute to the nice people who helped me test it I would like to offer them some goodies such as, for instance, the full final version of the app for free. For this, I was thinking...

iOS: What is the callback when tapped on the empty space between keyboard and search bar to dismiss the keyboard when search bar is active


ios,objective-c,swift
I have SearchController for my TableViewController. I wanted to perform some actions when user taps on the empty space on the screen (between the keyboard and search bar) to dismisses the keyboard and displays the main Table View.

Why doesn't a UITableView scroll until I have 2 additional rows?


ios,uitableview
Scenario: Embedded UITableView in a standard UIViewController's view. Three (3) 80-pt rows fill the UITableView. Problem: UITableView doesn't scroll until the number of rows > 5. I've tested this by varying the number of displayed rows and attempted to scroll. Three (3) rows fills the UITableView. Four (4) fills but...

Scaling everything up and down for different devices in UIStoryboard


ios,uistoryboard
Is it possible to have the storyboard scale everything up or down depending on the screen size or do I have to do it programmatically? For example the UI on iPhone 6 plus would look exactly like the one on iPhone 5 but just larger.

animating a view on top of uitableview


ios,swift,autolayout
I have a UINavigationController that has my custom ViewController with a tableView in it that takes up the whole screen. I want to push down the tableView and reveal a settings menu with just a couple items. My SettingsView.xib I created in a separate nib that is 320 x 90...

iOS 8 Swift CS193P Calculator Bug Switch Operation


ios,swift
I just started learning Swift with Stanford tutorial. I have Xcode 6.3.2. I'm getting a bug at a switch operation and can't understand how to solve it. I attached a screenshot as well @IBAction func operate(sender: UIButton) { let operation = sender.currentTitle! if userIsInTheMiddleOfTypingANumber{ enter() } switch operation{ case "➕":...

How to disable the Copy/Hide feature in UIImagePickerController when long pressing a image …?


ios,swift,ios8,uiimagepickercontroller,ios8.3
- Actually am using UIImagePickerController for my usecase,and if i long press any picture ,it shows Copy/Hide option (as shown in the sample image) - I dont want the Copy/Hide feature. Guide me with some suggestions if u too have encountered :)... Thanks in advance...iOS Geeks...PLZ refer my code snippet...

iOS 9 not opening Instagram app with URL SCHEME


ios,swift,swift2,ios9
The following URL opens on iOS 8.3 and lower, but it does not work and iOS 9 let instagramURL = NSURL(string: "instagram://app") Why won't the URL open?...

UITabBarViewController doesn't rotate - iOS


ios,uitabbarcontroller,auto-rotation,shouldstartload
I have a UITabBarViewController that contains 5 tabs and a login view which is not part of my tab bar, in my settings I have set that I support all device orientations. but when I run my app, only my login view is the only which rotates. I have created...

Trying to dismiss a popover view controller with a table view inside of it


ios,objective-c,uipopovercontroller
I'm trying to dismiss a popover when selecting a cell inside of it. I have created a custom delegate to support this however it is not working: In my class that houses the PopOver and table View I have the following: In .h: @protocol DismissDelegate <NSObject> -(void)didTap; @end @interface AssistanceNeededAtPopOverViewController...

try to recover views from custom cell


ios,uitableview
I made a custom cell from my storyboard, with an UIImageView and a UILabel. Each of them have a tag 100 for the imageView and 102 for UILabel. I try to get them in my datasource method but as below, they are still nil and I don't know why. ...

iOS Swift: Sound not playing on iPhone Simulator


ios,iphone,swift,audio,ios-simulator
In my iOS Swift application, and i am trying to play sound on click of a button. func playSound() { var audioPlayer = AVAudioPlayer() let soundURL = NSBundle.mainBundle().URLForResource("doorbell", withExtension: "mp3") audioPlayer = AVAudioPlayer(contentsOfURL: soundURL, error: nil) audioPlayer.play() } I am running the application in iOS iPhone Simulator. I have doorbell.mp3...

How to do a “show (e.g Push)” segue programatically without animation?


ios,objective-c,swift,storyboard,segue
How can I do a "show (e.g Push)" segue programatically without animation? None of the solutions I've found works the same way as the one in storyboard.

MFMessageComposeViewControllerDelegate not being called


ios,swift
I am trying to implement a class that will present a MFMessageComposeViewController from the AppDelegate. The class declaration looks like this: import UIKit import MessageUI class MyClass: NSObject, MFMessageComposeViewControllerDelegate { func sendAMessage() { // message view controller let messageVC = MFMessageComposeViewController() messageVC.body = "Oh hai!" messageVC.recipients = ["8675309"] // set...

Implementing Applovin Ads with Swift & SpriteKit


ios,swift,applovin
I would like some help with integrating interstitial ads from Applovin using Swift. Currently, I have managed to successfully integrate the SDK and initialize it using ALSdk.initializeSdk(). I have a folder in my project directory called Applovin which contains: headers folder (with all the .h files inside) and libApplovinSdk.a. I...

Call method after asynchronous request obj-c


ios,objective-c,asynchronous,uiviewcontroller,nsobject
In my app I init a new object, where there is method which calls NSURLConnection's sendAsynchronousRequest method. After the request, I would like to call a method in the caller UIViewController. I tried to use a static method but I then I can't control IBOutlets. How can I do this?...

After an insert into the UITableView : custom the cell


ios,objective-c,uitableview
I'm using insertion into my UITableView with this : Skill * newSkill = [[Skill alloc] init]; newSkill.name = @"Nouvelle compétence"; newSkill.pathPicto = @"generic"; [self.skills insertObject:newSkill atIndex:0]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [self.tableView beginUpdates]; [self.tableView insertRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationTop]; [self.tableView endUpdates]; It works great but now I want that the inserted cell be...

NS_ENUM as property in protocol


ios,objective-c,automatic-ref-counting
I came across to strange behaviour. I used to have: @property (nonatomic) ApplicationState applicationState; directly in my Application class. Now it's extracted to protocol @protocol ApplicationProtocol <NSObject> @property (nonatomic) ApplicationState applicationState; ApplicationState is Enum typedef NS_ENUM(NSUInteger, ApplicationState) { ApplicationStateNormal = 0, ApplicationStateExpanded = 1, ApplicationStateMaximized = 2 }; Now. It...

Twilio Client Python not Working in IOS Browser


javascript,python,ios,flask,twilio
I have created a simple twilio client application to make phone calls from Web Browser to phones. I used a sample Flask app to generate a secure Capability Token and used twilio.min.js library to handle calls from my HTML. The functionality works fine in Computer Browsers ans Android Phone Browsers,...

iPod Touch (5th gen) 'Source type 1 not available' crash when using UIImagePickerControllerSourceTypeCamera


ios,objective-c,ipod-touch
The iPod Touch (5th gen) has both a front and rear camera so why does my app crash when i try to present a UIImagePickerController with sourceType: UIImagePickerControllerSourceTypeCamera - (void)openImagePickerType:(NSString *)type { UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; if([type isEqualToString:kImagePickerCameraString]) imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; if([type isEqualToString:kImagePickerLibraryString]) imagePicker.sourceType =...

iOS Keyboard “Done” button load action


ios,swift,cocoa-touch
I'm trying to get "Done" button on to load an action, preferably the action that I have for my button. Here's the UITextField declaration let someTextField = UITextField() Trying to add a target to the textField someTextField.addTarget(self, action: "loginActionButton", forControlEvents: .EditingDidEndOnExit) ...

Build error after I localized Info.plist


ios,objective-c,xcode,swift,localization
I localized Info.plist : And I got this build error : error: could not read data from '/Users/cherif/Apps/Wesh/Info.plist': The file “Info.plist” couldn’t be opened because there is no such file. Actually there are now two Info.plist files : fr.lproj/Info.plist Base.lproj/Info.plist How to localize the Info.plist path ?...

Unexpectedly found nil while unwrapping an Optional value - Plist


ios,swift,plist
i am trying to read from propriety list using swift but im getting this error, and thats the code im using to read from my plist : Arrays i'm using : var recipeNames :[String] = [] var recipeImages :[String] = [] var recipeTime :[String] = [] In viewDidload : var...

Do I have to use both of these methods?


ios,swift,uitableview
When I expand a UITableViewCell on touch, I know I have to update the UITableView. Right now I'm doing: tableView.beginUpdates() tableView.reloadRowsAtIndexPaths(indexPaths, withRowAnimation: UITableViewRowAnimation.Automatic) tableView.endUpdates() Do I need to use both updates methods as well as the reload method? Or is it just one or the other? I'm not completely understanding,...