Search Results

Search found 102 results on 5 pages for 'ios5'.

Page 2/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • requestAccessToEntity for both iOS6 and 5.x - EKEventStore

    - by ShiShi
    following iOS6 eventKit and the new privacy settings I am using the following code - which works perfectly fine on iOS6 devices. Still, I would like the same code to work also for devices with iOS 5.x and I wish not to write a the "same code" twice - Seems wrong. Can anyone assist in an elegant solution ? EKEventStore *eventStore = [[EKEventStore alloc] init]; [eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) { // some code }];

    Read the article

  • Singleton Issues in iOS http client

    - by Andrew Lauer Barinov
    I implemented an HTTP client is iOS that is meant to be a singleton. It is a subclass of AFNetworking's excellent AFHTTPClient My access method is pretty standard: + (LBHTTPClient*) sharedHTTPClient { static dispatch_once_t once = 0; static LBHTTPClient *sharedHTTPClient = nil; dispatch_once(&once, ^{ sharedHTTPClient = [[LBHTTPClient alloc] initHTTPClient]; }); return sharedHTTPClient; } // my init method - (id) initHTTPClient { self = [super initWithBaseURL:[NSURL URLWithString:kBaseURL]]; if (self) { // Sub class specific initializations } return self; } Super's init method is very long, and can be found here However the problem I experience is when the dispatch_once queue is run, the app locks and become unresponsive. When I step through code, I notice that it locks on dispatch_once and then remains frozen. Is this something to do with the main thread locking down? How come it stays locked like that? Also, none of the HTTP client methods fire. Stepping through the code some more, I find this line in dispatch/once.h is where the app locks down: DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL_ALL DISPATCH_NOTHROW void _dispatch_once(dispatch_once_t *predicate, dispatch_block_t block) { if (DISPATCH_EXPECT(*predicate, ~0l) != ~0l) { dispatch_once(predicate, block); // App locks here } }

    Read the article

  • iOS 5 fixed positioning and virtual keyboard

    - by jeffc
    I have a mobile website which has a div pinned to the bottom of the screen via position:fixed. All works fine in iOS 5 (I'm testing on an iPod Touch) until I'm on a page with a form. When I tap into an input field and the virtual keyboard appears, suddenly the fixed position of my div is lost. The div now scrolls with the page as long as the keyboard is visible. Once I click Done to close the keyboard, the div reverts to its position at the bottom of the screen and obeys the position:fixed rule. Has anyone else experienced this sort of behavior? Is this expected? Thanks.

    Read the article

  • The rightCalloutAccessory button is not shown

    - by Luca
    I try to manage annotations, and to display an info button on the right of the view when a PIN get selected, my relevant code is this: - (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation { MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"greenPin"]; if ([annotation isKindOfClass:[ManageAnnotations class]]) { static NSString* identifier = @"ManageAnnotations"; MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; if (newAnnotation==nil) { newAnnotation=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; }else { newAnnotation.annotation=annotation; } newAnnotation.pinColor = MKPinAnnotationColorGreen; newAnnotation.animatesDrop = YES; newAnnotation.canShowCallout = YES; newAnnotation.rightCalloutAccessoryView=[UIButton buttonWithType:UIButtonTypeInfoLight]; return newAnnotation; }else { newAnnotation.pinColor = MKPinAnnotationColorGreen; newAnnotation.animatesDrop = YES; newAnnotation.canShowCallout = YES; return newAnnotation; } ManageAnnotations.m : @implementation ManageAnnotations @synthesize pinColor; @synthesize storeName=_storeName; @synthesize storeAdress=_storeAdress; @synthesize coordinate=_coordinate; -(id)initWithTitle:(NSString*)storeName adress:(NSString*)storeAdress coordinate:(CLLocationCoordinate2D)coordinate{ if((self=[super init])){ _storeName=[storeName copy]; _storeAdress=[storeAdress copy]; _coordinate=coordinate; } return self; } -(NSString*)title{ return _storeName; } -(NSString*)subtitle{ return _storeAdress; } ManageAnnotations.h @interface ManageAnnotations : NSObject<MKAnnotation>{ NSString *_storeName; NSString *_storeAdress; CLLocationCoordinate2D _coordinate; } // @property(nonatomic,assign)MKPinAnnotationColor pinColor; @property(nonatomic, readonly, copy)NSString *storeName; @property(nonatomic, readonly, copy)NSString *storeAdress; @property(nonatomic,readonly)CLLocationCoordinate2D coordinate; // -(id)initWithTitle:(NSString*)storeName adress:(NSString*)storeAdress coordinate:(CLLocationCoordinate2D)coordinate; // The PINS are shown correctly on the Map, but without the info button on the right of the view. Am i missing something?

    Read the article

  • ios - compile error: redefinition of label openURL

    - by GeekedOut
    I have a method like this: - (BOOL)webView:(UIWebView *)aWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { if ([request.URL.scheme isEqualToString:@"aaa"]) { openURL:[NSURL URLWithString:@"www.firstwebsite.com"]; } if ([request.URL.scheme isEqualToString:@"abc"]) { openURL:[NSURL URLWithString:@"http://www.someurl.com"]; } if ([request.URL.scheme isEqualToString:@"xyz"]) { openURL:[NSURL URLWithString:@"http://www.anothersite.com"]; } return YES; } and on the second and third uses of openURL I get a compile error: redefinition of label openURL Any idea why that happens and how to resolve it? Thanks!

    Read the article

  • Admob banner not getting remove from superview

    - by Gamer
    I am developing one 2d game using cocos2d framework, in this game i am using admob for advertising, in some classes not in all classes but admob banner is visible in every class and after some time game getting crash also. I am not getting how admob banner is comes in every class in fact i have not declare in Rootviewcontroller class. can any one suggest me how to integrate Admob in cocos2d game, i want Admob banner in particular classes not in every class, I am using latest google admob sdk, my code is below: Thanks in advance ` -(void)AdMob{ NSLog(@"ADMOB"); CGSize winSize = [[CCDirector sharedDirector]winSize]; // Create a view of the standard size at the bottom of the screen. if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ bannerView_ = [[GADBannerView alloc] initWithFrame:CGRectMake(size.width/2-364, size.height - GAD_SIZE_728x90.height, GAD_SIZE_728x90.width, GAD_SIZE_728x90.height)]; } else { // It's an iPhone bannerView_ = [[GADBannerView alloc] initWithFrame:CGRectMake(size.width/2-160, size.height - GAD_SIZE_320x50.height, GAD_SIZE_320x50.width, GAD_SIZE_320x50.height)]; } if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { bannerView_.adUnitID =@"a15062384653c9e"; } else { bannerView_.adUnitID =@"a15062392a0aa0a"; } bannerView_.rootViewController = self; [[[CCDirector sharedDirector]openGLView]addSubview:bannerView_]; [bannerView_ loadRequest:[GADRequest request]]; GADRequest *request = [[GADRequest alloc] init]; request.testing = [NSArray arrayWithObjects: GAD_SIMULATOR_ID, nil]; // Simulator [bannerView_ loadRequest:request]; } //best practice for removing the barnnerView_ -(void)removeSubviews{ NSArray* subviews = [[CCDirector sharedDirector]openGLView].subviews; for (id SUB in subviews){ [(UIView*)SUB removeFromSuperview]; [SUB release]; } NSLog(@"remove from view"); } //this makes the refreshTimer count -(void)targetMethod:(NSTimer *)theTimer{ //INCREASE OF THE TIMER AND SECONDS elapsedTime++; seconds++; //INCREASE OF THE MINUTOS EACH 60 SECONDS if (seconds>=60) { seconds=0; minutes++; [self removeSubviews]; [self AdMob]; } NSLog(@"TIME: %02d:%02d", minutes, seconds); } `

    Read the article

  • iOS app won't compile on device but works fine in simulator

    - by Jhorra
    I'm assuming this has something to do with linking, but I've removed RestKit and re-added it. I made sure all my connections and linking was in place. If I set XCode to use the simulator it runs fine, but as soon as I set it to run on any device it won't even build. The only other thing of note is this didn't start happening till I upgraded to XCode 4.5. Below are the errors it gives me ld: warning: ignoring file /Users/luke/Library/Developer/Xcode/DerivedData/ehrx-btsujlxuhtytahfaikwjeqfjybtt/Build/Products/Debug-iphoneos/libRestKit.a, file was built for archive which is not the architecture being linked (armv7s): /Users/luke/Library/Developer/Xcode/DerivedData/ehrx-btsujlxuhtytahfaikwjeqfjybtt/Build/Products/Debug-iphoneos/libRestKit.a Undefined symbols for architecture armv7s: "_OBJC_CLASS_$_RKClient", referenced from: objc-class-ref in ehrxAppDelegate.o objc-class-ref in ehrxLoginView.o objc-class-ref in ehrxInboxView.o objc-class-ref in ehrxCMView.o objc-class-ref in ehrxEncounterDemoView.o objc-class-ref in ehrxEncounterDiagListView.o objc-class-ref in ehrxEncounterChargeView.o ... ld: symbol(s) not found for architecture armv7s clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Read the article

  • How does UITableViewController knows its dataSource and delegate

    - by denniss
    I am following the BigNerdRanch iOS Programming book and I am on this one chapter that deals with UITableViewController. I have been wondering however where UITableViewController finds out about its delegate and dataSource. Currently I have it as @interface ItemsViewController : UITableViewController <UITableViewDataSource, UITableViewDelegate> But there is nothing that looks like: [self.tableView setDelegate:self] I am just wondering how the UITableViewController finds out about its delegate and dataSource

    Read the article

  • Why does iOS 5 fail to connect to a server running JDK 1.6, but not JDK 1.5

    - by KC Baltz
    We have a Java Socket Server listening on an SSLSocket (port 443) and an iOS application that connects with it. When running on iOS 5.1, the application stopped working when we upgraded the Java version of the server from JDK 1.5 to 1.6 (or 1.7). The app connects just fine to JDK 5 and 6 when running on iOS 6. The iOS app is reporting an error: -9809 = errSSLCrypto. On the Java side, we get javax.net.ssl.SSLException: Received fatal alert: close_notify. On the Java server side, we have enabled all the available cipher suites. On the client side we have tested enabling several different suites, although we have yet to complete a test involving each one individually enabled. Right now, it is failing when we use TLS_DH_anon_WITH_AES_128_CBC_SHA although it has failed with others and we are starting to think it's not the suite. Here is the debug output. It makes it all the way to ServerHelloDone and then fails shortly thereafter: Is secure renegotiation: false [Raw read]: length = 5 0000: 16 03 03 00 41 ....A [Raw read]: length = 65 0000: 01 00 00 3D 03 03 50 83 1E 0B 56 19 25 65 C8 F2 ...=..P...V.%e.. 0010: AF 02 AD 48 FE E2 92 CF B8 D7 A6 A3 EA C5 FF 5D ...H...........] 0020: 74 0F 1B C1 99 18 00 00 08 00 FF 00 34 00 1B 00 t...........4... 0030: 18 01 00 00 0C 00 0D 00 08 00 06 05 01 04 01 02 ................ 0040: 01 . URT-, READ: Unknown-3.3 Handshake, length = 65 *** ClientHello, Unknown-3.3 RandomCookie: GMT: 1333992971 bytes = { 86, 25, 37, 101, 200, 242, 175, 2, 173, 72, 254, 226, 146, 207, 184, 215, 166, 163, 234, 197, 255, 93, 116, 15, 27, 193, 153, 24 } Session ID: {} Cipher Suites: [TLS_EMPTY_RENEGOTIATION_INFO_SCSV, TLS_DH_anon_WITH_AES_128_CBC_SHA, SSL_DH_anon_WITH_3DES_EDE_CBC_SHA, SSL_DH_anon_WITH_RC4_128_MD5] Compression Methods: { 0 } Unsupported extension signature_algorithms, data: 00:06:05:01:04:01:02:01 *** [read] MD5 and SHA1 hashes: len = 65 0000: 01 00 00 3D 03 03 50 83 1E 0B 56 19 25 65 C8 F2 ...=..P...V.%e.. 0010: AF 02 AD 48 FE E2 92 CF B8 D7 A6 A3 EA C5 FF 5D ...H...........] 0020: 74 0F 1B C1 99 18 00 00 08 00 FF 00 34 00 1B 00 t...........4... 0030: 18 01 00 00 0C 00 0D 00 08 00 06 05 01 04 01 02 ................ 0040: 01 . %% Created: [Session-1, TLS_DH_anon_WITH_AES_128_CBC_SHA] *** ServerHello, TLSv1 RandomCookie: GMT: 1333992972 bytes = { 100, 3, 56, 153, 7, 2, 251, 64, 41, 32, 66, 240, 227, 181, 55, 190, 2, 237, 146, 0, 73, 119, 70, 0, 160, 9, 28, 207 } Session ID: {80, 131, 30, 12, 241, 73, 52, 38, 46, 41, 237, 226, 199, 246, 156, 45, 3, 247, 182, 43, 223, 8, 49, 169, 188, 63, 160, 41, 102, 199, 50, 190} Cipher Suite: TLS_DH_anon_WITH_AES_128_CBC_SHA Compression Method: 0 Extension renegotiation_info, renegotiated_connection: <empty> *** Cipher suite: TLS_DH_anon_WITH_AES_128_CBC_SHA *** Diffie-Hellman ServerKeyExchange DH Modulus: { 233, 230, 66, 89, 157, 53, 95, 55, 201, 127, 253, 53, 103, 18, 11, 142, 37, 201, 205, 67, 233, 39, 179, 169, 103, 15, 190, 197, 216, 144, 20, 25, 34, 210, 195, 179, 173, 36, 128, 9, 55, 153, 134, 157, 30, 132, 106, 171, 73, 250, 176, 173, 38, 210, 206, 106, 34, 33, 157, 71, 11, 206, 125, 119, 125, 74, 33, 251, 233, 194, 112, 181, 127, 96, 112, 2, 243, 206, 248, 57, 54, 148, 207, 69, 238, 54, 136, 193, 26, 140, 86, 171, 18, 122, 61, 175 } DH Base: { 48, 71, 10, 213, 160, 5, 251, 20, 206, 45, 157, 205, 135, 227, 139, 199, 209, 177, 197, 250, 203, 174, 203, 233, 95, 25, 10, 167, 163, 29, 35, 196, 219, 188, 190, 6, 23, 69, 68, 64, 26, 91, 44, 2, 9, 101, 216, 194, 189, 33, 113, 211, 102, 132, 69, 119, 31, 116, 186, 8, 77, 32, 41, 216, 60, 28, 21, 133, 71, 243, 169, 241, 162, 113, 91, 226, 61, 81, 174, 77, 62, 90, 31, 106, 112, 100, 243, 22, 147, 58, 52, 109, 63, 82, 146, 82 } Server DH Public Key: { 8, 60, 59, 13, 224, 110, 32, 168, 116, 139, 246, 146, 15, 12, 216, 107, 82, 182, 140, 80, 193, 237, 159, 189, 87, 34, 18, 197, 181, 252, 26, 27, 94, 160, 188, 162, 30, 29, 165, 165, 68, 152, 11, 204, 251, 187, 14, 233, 239, 103, 134, 168, 181, 173, 206, 151, 197, 128, 65, 239, 233, 191, 29, 196, 93, 80, 217, 55, 81, 240, 101, 31, 119, 98, 188, 211, 52, 146, 168, 127, 127, 66, 63, 111, 198, 134, 70, 213, 31, 162, 146, 25, 178, 79, 56, 116 } Anonymous *** ServerHelloDone [write] MD5 and SHA1 hashes: len = 383 0000: 02 00 00 4D 03 01 50 83 1E 0C 64 03 38 99 07 02 ...M..P...d.8... 0010: FB 40 29 20 42 F0 E3 B5 37 BE 02 ED 92 00 49 77 .@) B...7.....Iw 0020: 46 00 A0 09 1C CF 20 50 83 1E 0C F1 49 34 26 2E F..... P....I4&. 0030: 29 ED E2 C7 F6 9C 2D 03 F7 B6 2B DF 08 31 A9 BC ).....-...+..1.. 0040: 3F A0 29 66 C7 32 BE 00 34 00 00 05 FF 01 00 01 ?.)f.2..4....... 0050: 00 0C 00 01 26 00 60 E9 E6 42 59 9D 35 5F 37 C9 ....&.`..BY.5_7. 0060: 7F FD 35 67 12 0B 8E 25 C9 CD 43 E9 27 B3 A9 67 ..5g...%..C.'..g 0070: 0F BE C5 D8 90 14 19 22 D2 C3 B3 AD 24 80 09 37 ......."....$..7 0080: 99 86 9D 1E 84 6A AB 49 FA B0 AD 26 D2 CE 6A 22 .....j.I...&..j" 0090: 21 9D 47 0B CE 7D 77 7D 4A 21 FB E9 C2 70 B5 7F !.G...w.J!...p.. 00A0: 60 70 02 F3 CE F8 39 36 94 CF 45 EE 36 88 C1 1A `p....96..E.6... 00B0: 8C 56 AB 12 7A 3D AF 00 60 30 47 0A D5 A0 05 FB .V..z=..`0G..... 00C0: 14 CE 2D 9D CD 87 E3 8B C7 D1 B1 C5 FA CB AE CB ..-............. 00D0: E9 5F 19 0A A7 A3 1D 23 C4 DB BC BE 06 17 45 44 ._.....#......ED 00E0: 40 1A 5B 2C 02 09 65 D8 C2 BD 21 71 D3 66 84 45 @.[,..e...!q.f.E 00F0: 77 1F 74 BA 08 4D 20 29 D8 3C 1C 15 85 47 F3 A9 w.t..M ).<...G.. 0100: F1 A2 71 5B E2 3D 51 AE 4D 3E 5A 1F 6A 70 64 F3 ..q[.=Q.M>Z.jpd. 0110: 16 93 3A 34 6D 3F 52 92 52 00 60 08 3C 3B 0D E0 ..:4m?R.R.`.<;.. 0120: 6E 20 A8 74 8B F6 92 0F 0C D8 6B 52 B6 8C 50 C1 n .t......kR..P. 0130: ED 9F BD 57 22 12 C5 B5 FC 1A 1B 5E A0 BC A2 1E ...W"......^.... 0140: 1D A5 A5 44 98 0B CC FB BB 0E E9 EF 67 86 A8 B5 ...D........g... 0150: AD CE 97 C5 80 41 EF E9 BF 1D C4 5D 50 D9 37 51 .....A.....]P.7Q 0160: F0 65 1F 77 62 BC D3 34 92 A8 7F 7F 42 3F 6F C6 .e.wb..4....B?o. 0170: 86 46 D5 1F A2 92 19 B2 4F 38 74 0E 00 00 00 .F......O8t.... URT-, WRITE: TLSv1 Handshake, length = 383 [Raw write]: length = 388 0000: 16 03 01 01 7F 02 00 00 4D 03 01 50 83 1E 0C 64 ........M..P...d 0010: 03 38 99 07 02 FB 40 29 20 42 F0 E3 B5 37 BE 02 .8....@) B...7.. 0020: ED 92 00 49 77 46 00 A0 09 1C CF 20 50 83 1E 0C ...IwF..... P... 0030: F1 49 34 26 2E 29 ED E2 C7 F6 9C 2D 03 F7 B6 2B .I4&.).....-...+ 0040: DF 08 31 A9 BC 3F A0 29 66 C7 32 BE 00 34 00 00 ..1..?.)f.2..4.. 0050: 05 FF 01 00 01 00 0C 00 01 26 00 60 E9 E6 42 59 .........&.`..BY 0060: 9D 35 5F 37 C9 7F FD 35 67 12 0B 8E 25 C9 CD 43 .5_7...5g...%..C 0070: E9 27 B3 A9 67 0F BE C5 D8 90 14 19 22 D2 C3 B3 .'..g......."... 0080: AD 24 80 09 37 99 86 9D 1E 84 6A AB 49 FA B0 AD .$..7.....j.I... 0090: 26 D2 CE 6A 22 21 9D 47 0B CE 7D 77 7D 4A 21 FB &..j"!.G...w.J!. 00A0: E9 C2 70 B5 7F 60 70 02 F3 CE F8 39 36 94 CF 45 ..p..`p....96..E 00B0: EE 36 88 C1 1A 8C 56 AB 12 7A 3D AF 00 60 30 47 .6....V..z=..`0G 00C0: 0A D5 A0 05 FB 14 CE 2D 9D CD 87 E3 8B C7 D1 B1 .......-........ 00D0: C5 FA CB AE CB E9 5F 19 0A A7 A3 1D 23 C4 DB BC ......_.....#... 00E0: BE 06 17 45 44 40 1A 5B 2C 02 09 65 D8 C2 BD 21 ...ED@.[,..e...! 00F0: 71 D3 66 84 45 77 1F 74 BA 08 4D 20 29 D8 3C 1C q.f.Ew.t..M ).<. 0100: 15 85 47 F3 A9 F1 A2 71 5B E2 3D 51 AE 4D 3E 5A ..G....q[.=Q.M>Z 0110: 1F 6A 70 64 F3 16 93 3A 34 6D 3F 52 92 52 00 60 .jpd...:4m?R.R.` 0120: 08 3C 3B 0D E0 6E 20 A8 74 8B F6 92 0F 0C D8 6B .<;..n .t......k 0130: 52 B6 8C 50 C1 ED 9F BD 57 22 12 C5 B5 FC 1A 1B R..P....W"...... 0140: 5E A0 BC A2 1E 1D A5 A5 44 98 0B CC FB BB 0E E9 ^.......D....... 0150: EF 67 86 A8 B5 AD CE 97 C5 80 41 EF E9 BF 1D C4 .g........A..... 0160: 5D 50 D9 37 51 F0 65 1F 77 62 BC D3 34 92 A8 7F ]P.7Q.e.wb..4... 0170: 7F 42 3F 6F C6 86 46 D5 1F A2 92 19 B2 4F 38 74 .B?o..F......O8t 0180: 0E 00 00 00 .... [Raw read]: length = 5 0000: 15 03 01 00 02 ..... [Raw read]: length = 2 0000: 02 00 .. URT-, READ: TLSv1 Alert, length = 2 URT-, RECV TLSv1 ALERT: fatal, close_notify URT-, called closeSocket() URT-, handling exception: javax.net.ssl.SSLException: Received fatal alert: close_notify FYI, this works in iOS 6.0

    Read the article

  • UITableView: Handle cell selection in a mixed cell table view static and dynamic cells

    - by AlexR
    I am trying to mix dynamic and static cells in a grouped table view: I would like to get two sections with static cells at the top followed by a section of dynamic cells (please refer to the screenshot below). I have set the table view contents to static cells. Edit Based on AppleFreak's advice I have changed my code as follows: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell; if (indexPath.section <= 1) { // section <= 1 indicates static cells cell = [super tableView:tableView cellForRowAtIndexPath:indexPath]; } else { // section > 1 indicates dynamic cells CellIdentifier = [NSString stringWithFormat:@"section%idynamic",indexPath.section]; cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; } return cell; } However, my app crashes with error message Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:' for section 0 and row 0. The cell returned from cell = [super tableView:tableView cellForRowAtIndexPath:indexPath] for section 0 and row 0 is nil. What is wrong with my code? Could there be any problems with my outlets? I haven't set any outlets because I am subclassing UITableViewController and supposedly do not any outlets for tableview to be set (?). Any suggestions on how to better do it? Edit II I have recreated my scene in storyboard (please refer to my updated screen shot above) and rewritten the view controller in order to start from a new base. I have also read the description in Apple's forum as applefreak suggested. However, I run in my first problem with the method numberOfSectionsInTableView:tableView, in which I increment the number of static sections (two) by one. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [super numberOfSectionsInTableView:tableView] + 1 ; } The app crashed with the error message: Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayI objectAtIndex:]: index 2 beyond bounds [0 .. 1]' Why is this code not working for me even though I followed Apple's and applefreak recommendations? It is possible that the tableView has changed a bit in iOS 6? Solution: I got this to work now using AppleFreaks code sample in his answer below. Thank you, AppleFreak! Edit III: Cell Selection: How can I handle cell selection in a mixed (dynamic and static cells) cell table view? When do I call super and when do I call self tableView? When I use [[super tableView] selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone] and try to check for the selected index paths with: UITableView *tableView = [super tableView]; if ( [[tableView indexPathForSelectedRow] isEqual:customGrowthIndexPath] ) { .. } I get an return value of nil. As I can't find the source of my error, I really would appreciate your help

    Read the article

  • ARC, worth it or not?

    - by MSK
    When I moved to Objective C (iOS) from C++ (and little Java) I had hard time understanding memory management in iOS. But now all this seems natural and I know retain, autorelease, copy and release stuff. After reading about ARC, I am wondering is there more benefits of using ARC or it is just that you dont have to worry about memory management. Before moving to ARC I wanted to know how worth is moving to ARC. XCode has "Convert to Objective C ARC" menu. Is the conversion is that simple (nothing to worry about)? Does it help me in reducing my apps memory foot-print, memory leaks etc (somehow ?) Does it has much testing impact on my apps ? What are non-obvious advantages? Any Disadvantage os moving to it?

    Read the article

  • pull down notification panel in iOS help for iPad

    - by Priya Chhabra
    I have developed an iPad application. In which I am using left/right swipes from corner of screen. The problem is when device is in landscape mode, (though the application is always in portrait orientation) and user wants to swipe left, it opens the notification panel instead of going to swipeAction that I had defined. Note that it works fine when device is kept in portrait mode. Is there any way to make pull down notification panel application orientation specific ? Any kind of help will be appreciated.

    Read the article

  • iOS: Gesture recogniser for smooth scrolling and flicking a View

    - by AppleDeveloper
    I am building an iPad app where I needed to allow resizing views functionality using divider view provided between two views. This divider view is just a 20px height view between two half screen content views - please refer attached images. When user scrolls this divider view up or down, both content views changes their sizes appropriately. I have extended UIView and implemented this using touchMoved delegate as code given below in touchesMoved delegate. It works fine. The only thing is missing with TouchMoved is you can't flick divider view to top or bottom directly. You have to scroll all the way to top or bottom! To support flicking the view I have tried UIPanGestureRecognizer but I don't see smooth scrolling with it. When I handle split position change in UIGestureRecognizerStateChanged state, just touching divider view flick it to top or bottom. Handling split position change in UIGestureRecognizerStateEnded does the same but I don't see content view resizing with dividerview scrolling! Could someone please tell me how could I achieve both smooth scrolling of divider view with resizing content views(like touchMoved) and flicking the view. Any alternative approach would also fine. Thanks. - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; if (touch) { CGPoint lastPt = [touch previousLocationInView:self]; CGPoint pt = [touch locationInView:self]; float offset = pt.y - lastPt.y; self.parentViewController.splitPosition = self.parentViewController.splitPosition + offset; } } - (void)handlePan:(UIPanGestureRecognizer*)recognizer { CGPoint translation = [recognizer translationInView:recognizer.view]; CGPoint velocity = [recognizer velocityInView:recognizer.view]; if (recognizer.state == UIGestureRecognizerStateBegan) { } else if (recognizer.state == UIGestureRecognizerStateChanged) { // If I change split position here, I don't see smooth scrolling dividerview...it directly jumps to the top or bottom! self.parentViewController.splitPosition = self.parentViewController.splitPosition + translation.y; } else if (recognizer.state == UIGestureRecognizerStateEnded) { // If I change split position here, the same thing happens at end and I don't see my divider view moving with my scrolling and resizing my views. self.parentViewController.splitPosition = self.parentViewController.splitPosition + translation.y; } } Initial screen Increased top view size by scrolling divider view Top view is totally hidden here but I have to scroll divider view all the way to top. I want to flick the divider view so that it directly goes from any position to top

    Read the article

  • Delegate Methods Not Firing on Search Results Table

    - by Slinky
    All, I have a UITableView w/detail, with a Search bar, created from code. Works fine on selected items except it doesn't work when an item is clicked from the search results; no delegate methods fire. Never seen this type of behavior before so I don't know where the issue lies. I get the same behavior with standard table cells as well as custom table cells. Appreciate any guidance on this and thanks. Just Hangs Here //ViewController.h @interface SongsViewController : UITableViewController <UISearchBarDelegate,UISearchDisplayDelegate> { NSMutableArray *searchData; UISearchBar *searchBar; UISearchDisplayController *searchDisplayController; UITableViewCell *customSongCell; } //ViewController.m -(void)viewDidLoad { [super viewDidLoad]; CGRect screenRect = [[UIScreen mainScreen] bounds]; CGFloat screenWidth = screenRect.size.width; searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, screenWidth, 88)]; [searchBar setShowsScopeBar:YES]; [searchBar setScopeButtonTitles:[[NSArray alloc] initWithObjects:@"Title",@"Style", nil]]; searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self]; searchDisplayController.delegate = self; searchDisplayController.searchResultsDataSource = self; self.tableView.tableHeaderView = searchBar; //Load custom table cell UINib *songCellNib = [UINib nibWithNibName:@"SongItem" bundle:nil]; //Register this nib, which contains the cell [[self tableView] registerNib:songCellNib forCellReuseIdentifier:@"SongItemCell"]; // create a filtered list that will contain products for the search results table. SongStore *ps = [SongStore defaultStore]; NSArray *songObjects = [ps allSongs]; self.filteredListContent = [NSMutableArray arrayWithCapacity: [songObjects count]]; self.masterSongArr = [[NSMutableArray alloc] initWithArray:[ps allSongs]]; [self refreshData]; [self.tableView reloadData]; self.tableView.scrollEnabled = YES; }

    Read the article

  • Error while compiling pjsip 2 for cxode 4.3.2 and SDK 5.1

    - by Linus Persson
    I'm trying to compile pjsip version 2 using the terminal and I'm getting constant error no matter what I try. Been looking for the answer all over the internet including stackoverflow. I downloaded pjsip version 2 using their subversion repository today so all files should be up to date. When following this guide: http://trac.pjsip.org/repos/wiki/Getting-Started/iPhone I get this error after running "make dep && make clean && make": ld: symbol(s) not found for architecture armv7 collect2: ld returned 1 exit status make[2]: *** [../bin/pjsua-arm-apple-darwin9] Error 1 make[1]: *** [pjsua] Error 2 make: *** [all] Error 1 When using the above guide combined with this guide: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2011-October/013481.html I get this error after running "make dep && make clean && make": ld: symbol(s) not found for architecture arm collect2: ld returned 1 exit status make[2]: *** [../bin/pjsua-arm-apple-darwin10] Error 1 make[1]: *** [pjsua] Error 2 make: *** [all] Error 1 I've included /pjlib/include/pj/config_site.h with the following code: #define PJ_CONFIG_IPHONE 1 #include <pj/config_site_sample.h> How do I get pjsip to compile without errors? Please consider that I'm new to this, thank you!

    Read the article

  • Received memory warning on setimage

    - by Sam Budda
    This problem has completely stumped me. This is for iOS 5.0 with Xcode 4.2 What's going on is that in my app I let user select images from their photo album and I save those images to apps document directory. Pretty straight forward. What I do then is that in one of the viewController.m files I create multiple UIImageViews and I then set the image for the image view from one of the picture that user selected from apps dir. The problem is that after a certain number of UIImage sets I receive a "Received memory warning". It usually happens when there are 10 pictures. If lets say user selected 11 pictures then the app crashes with Error (GBC). NOTE: each of these images are at least 2.5 MB a piece. After hours of testing I finally narrowed down the problem to this line of code [button1AImgVw setImage:image]; If I comment out that code. All compiles fine and no memory errors happen. But if I don't comment out that code I receive memory errors and eventually a crash. Also note it does process the whole CreateViews IBAction but still crashes at the end. I cannot do release or dealloc since I am running this on iOS 5.0 with Xcode 4.2 Here is the code that I used. Can anyone tell me what did I do wrong? - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self CreateViews]; } -(IBAction) CreateViews { paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask ,YES); documentsPath = [paths objectAtIndex:0]; //here 15 is for testing purposes for (int i = 0; i < 15; i++) { //Lets not get bogged down here. The problem is not here UIImageView *button1AImgVw = [[UIImageView alloc] initWithFrame:CGRectMake(10*i, 10, 10, 10)]; [self.view addSubview:button1AImgVw]; NSMutableString *picStr1a = [[NSMutableString alloc] init]; NSString *dataFile1a = [[NSString alloc] init]; picStr1a = [NSMutableString stringWithFormat:@"%d.jpg", i]; dataFile1a = [documentsPath stringByAppendingPathComponent:picStr1a]; NSData *potraitImgData1a =[[NSData alloc] initWithContentsOfFile:dataFile1a]; UIImage *image = [[UIImage alloc] initWithData:potraitImgData1a]; // This is causing my app to crash if I load more than 10 images! //[button1AImgVw setImage:image]; } NSLog(@"It went to END!"); } //Error I get when 10 images are selected. App does launch and work 2012-10-07 17:12:51.483 ABC-APP[7548:707] It went to END! 2012-10-07 17:12:51.483 ABC-APP [7531:707] Received memory warning. //App crashes with this error when there are 11 images 2012-10-07 17:30:26.339 ABC-APP[7548:707] It went to END! (gdb)

    Read the article

  • UITableView: Mixing static and dynamic cells

    - by AlexR
    I am trying to mix dynamic and static cells in a grouped table view: I would like to get two sections with static cells at the top followed by a section of dynamic cells (please refer to the screenshot below). I have set the table view contents to static cells. I designed the static cells in Interface Builder and gave them identifiers related to their section and row: "section0static0", "section0static1", "section1static0" and "section1static1". I named the dynamic cell "section2dynamic". My delegate methods, in which I am trying to return the correct cell identifier (static or dynamic) are as follows: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { switch (section) { case 0: return 2; break; case 1: return 2; break; case 2: return 0; break; default: break; } return 0; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @""; if (indexPath.section <= 1) CellIdentifier = [NSString stringWithFormat:@"section%istatic%i",indexPath.section,indexPath.row]; else CellIdentifier = [NSString stringWithFormat:@"section%idynamic",indexPath.section]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; return cell; } Edit Based on AppleFreak's advice I have changed my code as follows: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell; if (indexPath.section <= 1) { // section <= 1 indicates static cells cell = [super tableView:tableView cellForRowAtIndexPath:indexPath]; } else { // section > 1 indicates dynamic cells CellIdentifier = [NSString stringWithFormat:@"section%idynamic",indexPath.section]; cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; } return cell; } However, my app crashes with error message Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:' for section 0 and row 0. The cell returned from cell = [super tableView:tableView cellForRowAtIndexPath:indexPath] for section 0 and row 0 is nil. What is wrong with my code? Could there be any problems with my outlets? I haven't set any outlets because I am subclassing UITableViewController and supposedly do not any outlets for tableview to be set (?). Any suggestions on how to better do it?

    Read the article

  • App crashes frequently at time when UIActionSheet would be presented

    - by Jim Hankins
    I am getting the following error intermittently when a call is made to display an action sheet. Assertion failure in -[UIActionSheet showInView:] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: view != nil' Now in this case I've not changed screens. The UIActionSheet is presented when a local notification is fired and I have an observer call a local method on this view as such: I have the property marked as strong. When the action sheet is dismissed I also set it to nil. I am using a story board for the UI. It's fairly repeatable to crash it, perhaps less than 5 tries. (Thankfully I have that going for me). Any suggestions what to try next? I'm really pulling my hair out on this one. Most of the issues I've seen on this topic are pointing to the crash occurring once the selection is made. In my case it's at presentation and intermittently. Also for what it's worth, this particular view is several stacks deep in an embedded navigation controller. Hometableviewdetail selectviewController in question. This same issue occurs so far in testing on iOS 5.1 and iOS 6. I'm presuming it's something to do with how the show InView is being targeted. self.actionSheet = [[UIActionSheet alloc] initWithTitle:@"Select Choice" delegate:self cancelButtonTitle:@"Not Yet" destructiveButtonTitle:@"Do this Now" otherButtonTitles:nil]; [self.actionSheet showInView:self.parentViewController.tabBarController.view];

    Read the article

  • How can I make a UIPickerView like a UIDatePicker?

    - by iamthepiguy
    I have a custom UIViewController subclass which acts as Datasource and Delegate for a UIPickerView which I would like to serve two different purposes, as each are simple enough, and don't really warrant separate files. One operation must be as a custom picker, and this works fine. However, for the other operation, I want it to act just like a UIDatePicker. The problem is, UIDatePicker is a subclass of UIControl, not UIPickerView. Is there any sort of enum value I can set in a method (or other way) that will set the UIPickerView to act as a date picker? Or do I have to make two completely different classes and use them differently (pain in the ass)?

    Read the article

  • Parsing json in ios

    - by gaps
    i have the follwing json string ,can anybody tell me how to get the value of role_name {"response":"success","user":{"created_at":"2011-11-16T05:48:31Z","ud_id":"1234567890","last_sign_in_ip":"182.72.141.194","updated_at":"2011-11-19T08:58:27Z","account_id":21,"last_name":"dfg","role_name":"Parent","email":"[email protected]","first_name":"abc"},"status":"200"} code for parsing is NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; NSLog(@"resp--- %@",responseString); NSArray* latestLoans = [(NSDictionary*)[responseString JSONValue] objectForKey:@"user"]; NSDictionary* loan = [latestLoans objectAtIndex:0]; NSString* name = [loan objectForKey:@"last_name"];

    Read the article

  • Two "Calendar" entries listed on iPad - can't write to calendar using EventKit

    - by Neal
    My iOS app integrates with the device's calendar. On my iPad when I view the calendar app and tap the Calendars button on the top left to choose which calendars to show I see one entry named "Calendar". In my app when I loop through available calendars per the code below "Calendar" is listed twice. One is CalDAV for the type, the other is Local. I'm unable to create calendar entries in one of them, I believe the "Local" one, not sure why. Why do I see "Calendar" listed twice when I do NOT see it listed twice in the iCal app? public static List<string> Calendars { get { var calendars = new List<string>(); var ekCalendars = EventStore.Calendars; if (ekCalendars != null && ekCalendars.Length > 0) { foreach (EKCalendar cal in ekCalendars) { if (cal.AllowsContentModifications) calendars.Add(cal.Title); } calendars.Sort(); } return calendars; } }

    Read the article

  • How to add a custom button to a UINavigationBar (a la Foursquare)

    - by jfisk
    Im going through the different options of creating a custom UINavigationBar and since my app is iOS 5+, i am using this code: // Set the background image all UINavigationBars [[UINavigationBar appearance] setBackgroundImage:NavigationPortraitBackground forBarMetrics:UIBarMetricsDefault]; Now i want a custom image button on the very right side and am a bit lost. Should I go another way, subclass UINavigationBar and add a button to it or would there be an easier way?

    Read the article

  • iOS: Text translation from English to different language and visa-versa

    - by AppleDeveloper
    I want to translate English texts to different languages from my iPad App. These texts are generated dynamically from the front end website so I can use static mapping between English and other language. Basically I will receive line of text in English from the server and I want to convert it to iPad's Locale language settings and display it. Is there anyone I can achieve this? Can I use Google translator? Thanks.

    Read the article

  • UiButton / IBAction - link from a RootView to mainView in Storyboard

    - by webschnecke
    I try to call the main ViewController on my storyboard. In my app there is a additional .h, .m file with no xib or storyboard. In this .m file T craeted a button: UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button addTarget:self action:@selector(home:)forControlEvents:UIControlEventTouchDown]; [button setTitle:@"Show View" forState:UIControlStateNormal]; button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); [self.view addSubview:button]; NSLog(@"Home-Button line 645"); This button should link to my main ViewController in the Storyboard. The view has the identifier HauptMenu. I got no error, but the view doesnt change to my main ViewController. What is wrong? - (IBAction)home:(id)sender { NSLog(@"Button was tapped"); ViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"HauptMenu"]; NSLog(@"1"); [viewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal]; NSLog(@"2"); [self.navigationController pushViewController:viewController animated:NO]; [viewController release]; NSLog(@"3"); }

    Read the article

  • Grouped UITableView's cell separator missing when setting backgroundView with an image

    - by Howard Spear
    I have a grouped UITableView with a custom UITableViewCell class and I am adding a custom background image to each cell. However, when I do this, the cell's separator is not visible. If simply switch the table style to Plain instead of Grouped, the separator is showing up. I need the grouped table - how do I make the separator show up? Here's my code: @interface MyCustomTableViewCell : UITableViewCell @end @implementation MyCustomTableViewCell // because I'm loading the cell from a xib file - (id)initWithCoder:(NSCoder *)coder { self = [super initWithCoder:coder]; if (self) { // Create a background image view. self.backgroundView = [[UIImageView alloc] init]; } return self; } // MyViewController - (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // // standard cell dequeue + create cell code here // // // Configure the cell background now // UIImage *backgroundImage = [UIImage imageNamed:@"odd_row.png"]; if (indexPath.row % 2 == 0) { backgroundImage = [UIImage imageNamed:@"even_row.png"]; } UIImageView *backgroundView = (UIImageView *)cell.backgroundView; backgroundView.image = backgroundImage; }

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >