I've just encountered the strangest problem with the three20 thumbs viewer.
When running in debug, my TTThumbsViewController works completely normally, however if I switch to release mode (ad-hoc and on the live app store version), I get some pretty weird graphical glitches.
For example, the loading view of the thumb controller:
http://img.skitch.com/20120125-kugx5diqbs8sttnxatrppf4rjg.jpg
And then all my thumbnails get squashed:
http://img.skitch.com/20120125-mi3mpkr1j1s9f79fdf9r3krjhs.jpg
I'm running the latest (master) version of three20, and have only made one slight modification to the source, to stop the header bar appearing at the top of the gallery view.
I added the following method to TTTableViewDelegate.m:
- (float)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 0; // disable headers in TTTableViews - prevents header on thumbs view in iOS 5
}
In conclusion:
Can anyone repro (with release)?
What can I do?
Would that modification I made be causing these issues (bear in mind it only happens with the release build)?
If anyone has any ideas that would be great as this is currently live on the app store (I know I'm an idiot for not testing with release - this should teach me).
The problem is with the LLVM compiler bundled with Xcode 4.2 when compiling for armv6 devices on iOS 4.2.1.
The problem and solution are described here:
Strange layout issue on 3GS device with iOS 4.2.1 - Compiled with iOS 5
You need to add the -mno-thumb flag to your compiler flags for armv6 i.e.
Method with setting -mno-thumb in MY PROJECT SETTINGS didn't worked for me, But this is exactly issue of the
LLVM compiler bundled with Xcode 4.2 when compiling for armv6 devices
Fast way to do this is to update little Three20's Library.xconfig, which is located in
Three20/src/Configurations/common folder
Find the line for linker flags configuration, and add line with -mno-thumb to it.
// Linker Flags
OTHER_LDFLAGS = $(OBJC_LIBRARY)
// We needed this to resolve horrible bug
// When your'e setting value on origin.x and it is applied to origin.y
OTHER_CFLAGS[arch=armv6] = -mno-thumb
Profit.
Related
My App, which is created for iOS4, is crashing in iOS6 and is not installing on simulator or device.
It just shows the splash screen and crashes.
Did finish Launching is not being called.
Can anybody please Help?
Finally i got the solution of my problem mentioned above.
In my ios4 App, in FirstViewController.xib "Use AutoLayout" was checked.
I just removed the checkmark and my App start working.
Amazing!!!
I would recommend creating a new project, and either carefully looking for the changes in delegate or any deprecated code, or just moving all of your code to the new project. Also, you should run a convert to modern syntax check.
There may be issue with Application Delegate. The obvious reason - your object is not set as an application delegate.
Looking at Apple documentation there is quite a few ways to accomplish it:
Remove application delegate binding in Interface Builder (.xib file
for the window) Set 4th parameter of UIApplicationMain in main.h to
something else than nil.
Check you nib file in Interface Builder and see if the App Delegate is setup.
Or Reference to documentation Core Application Design
Hope this will you out.
Look into the release notes of xcode, ios6
It is said that when working with IOS6, Auto Layout is turned on and that crashes the app if used on older versions. Check the link, which has other things to watch out for:
https://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-Xcode/_index.html
https://developer.apple.com/library/ios/#releasenotes/General/RN-iOSSDK-6_0/_index.html
I'm not sure how to explain this one. I submitted an update of one of my apps to the store yesterday. The first screenshot is how one particular screen appears running on my iPhone 3G, running iOS 4.2.1, downloaded from the App Store:
And the second image below is the exact same code, no changes have been made since the original submission, running on the exact same device tethered through Xcode.
The application runs fine on my iPhone 4, running iOS 5, downloaded from the App Store. So to recap:
App obtained from App Store is flawed on iPhone 3G
App obtained from App Store is good on iPhone 4
App tethered through Xcode is good on iPhone 3G
These are not the only graphical inconsistencies, but they're all related to custom UITableViewCell code, which doesn't do anything more than push labels a few pixels in each directory, and has been working fine since day one. I have filed a report with idp-dts, and am waiting to hear back from them, but as the waiting list is usually a week or more, I'd rather figure this out on my own.
Any help/tips/guesses would be very appreciated!
iPhone 3G running App Store version of my application:
iPhone 3G running Xcode tethered version of my application:
Edit: This sounds quite similar to this problem: Building with LLVM and any optimization causes app to crash on startup The customer who contacted me was using a 2nd generation iPod Touch, the only other hardware other than the iPhone 3G that uses armv6.
Edit 2: Here's the snippet of code that sets the bounds of the color bar on the left side. There doesn't seem to be anything fishy going on in the code:
- (void)layoutSubviews {
CGRect colorViewFrame = self.bounds;
colorViewFrame.size.width = 6;
colorViewFrame.origin.y += 3;
colorViewFrame.origin.x -= 1;
colorViewFrame.size.height -= 8;
colorView.frame = colorViewFrame;
...
}
So here's what I found under Build Settings:
Which, having taken a class or two in compiler optimization, makes sense. Code debugging on a device should be left in its original state for debugging purposes, and code released should be optimized for speed and efficiency.
So here's the fun part. Changing my Debug setting to Fastest, Smallest:
Causes the issue to occur on my device while running tethered in Xcode.
Before filing a Radar or making any rash decisions and submitting non-optimized code to the App Store, is there anything else I should consider investigating? Was the compiler optimization really the underlying cause of the layout issues?
Edit: And if the optimization level is the issue, why does the optimized code run properly on my iPhone 4, but not properly on my iPhone 3G?
Edit 2: This problem sounds extremely similar to this answer: Building with LLVM and any optimization causes app to crash on startup
Edit 3: Heard back from Apple Radar, this is a known issue. Will be fixed in a future version of Xcode. Thanks for all the help guys!
I have the same issue, and have found a workaround for the problem.
I found after doing some NSLog's on the optimised and unoptimised code, that CGSize's were becoming corrupt after the first time the height parameter was accessed.
so this code was in my UITableViewCell subclass layoutSubviews:
NSLog(#"size.height %f", size.height);
NSLog(#"2nd access size.height %f", size.height);
_titleLabel.frame = CGRectMake(kLeftSpacer, kSpacerHeight, kTitleWidth ,size.height);
NSLog(#"after setFrame size.height %f", size.height);
gave the following in the log:
size.height 19.000000
2nd access size.height 56.00000
after setFrame size.height 56.00000
So, my workaround was to use an intermediate height identifier:
CGFloat height = size.height;
NSLog(#"size.height %f", size.height);
_titleLabel.frame = CGRectMake(kLeftSpacer, kSpacerHeight, kTitleWidth ,height);
NSLog(#"after setFrame size.height %f", size.height);
and all was fine...
I guess not as safe as turning off optimisations, but the rest of my app seems fine...always best to test with release builds then!
If you are adding and laying out views in a table view cell, you should add them to the cells's contentView and use self.contentView.bounds instead of self.bounds in all of your layout code.
You also need to call [super layoutSubviews] otherwise many strange things will happen.
The answer is to add a compiler flag -mno-thumb for armv6 compilations, and not to add it for armv7 compilations.
Howto is available: Is there a way to compile for ARM rather than Thumb in Xcode 4?
Any suggestions on how to work around this UITableView Leak?
Here's a link to a very basic test project that produces the problem:
http://www.maani.us/temp/Test.zip
To reproduce the leak:
Run the project with the "Leaks" performance tool.
In the table view, click '4' in the right-side Index to jump to section 4.
Scroll up a bit to display a couple of cells from section 3.
Wait for a few seconds. This generates a leak in the instrument.
I tested this both with version 4.2 and 4.3, both with the simulator and a device. All tests produce the leak.
Thank you for you help.
Are you testing this in the simulator or on the device? There are some known leaks with UITableViewControllers in the simulators that do not happen on hardware.
I ran this myself in my the simulator and the only leaks I am getting are for NSIndexPAth and generic 16 byte blocks, both of which are discussed on the internet as being leaked only on the simulator. You can also look at the leaks and see they are created and only accessed within the foundation framework. Therefore, it definitely seems to be a problem with the framework itself. One possible fix for this is to use a UIViewController and setup the UITableView yourself.
The test project above contains only the minimal code necessary to build a UITable and confirm that the leak is in the foundation framework (NSIndexPAth).
Yes, the leak happens on devices too.
The original code used a UIViewController that displayed a UITableView. That too produced a leak. I removed UIViewController to narrow down the problem and confirm that the leak still happens without too.
The only thing that removed the problem is removing the UITable section Index (sectionIndexTitlesForTableView:tableView), which is not a possible option in the final App.
I have written an iPhone and iPad universal app which runs fine in the iPad simulator on Xcode, but I would now like to test the iPhone functionality. I seem unable to run the iPhone simulator with this code as it always defaults to the iPad?
Instead I tried to run on the device and as it begins to run I get the following error:
dyld: Symbol not found: _OBJC_CLASS_$_UISplitViewController
Referenced from: /var/mobile/Applications/9770ACFA-0B88-41D4-AF56-77B66B324640/Test.app/Test
Expected in: /System/Library/Frameworks/UIKit.framework/UIKit in /var/mobile/Applications/9770ACFA-0B88-41D4-AF56-77B66B324640/Test.app/TEST
As the App is built programmatically rather than using XIB's, I've split the 2 device logics using the following lines in the main.m method:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
retVal = UIApplicationMain(argc, argv, nil, #"AppDelegate_Pad");
}
else
{
retVal = UIApplicationMain(argc, argv, nil, #"AppDelegate_Phone");
}
From that point forth they use different AppDelegates and I've checked my headers to ensure the UISplitView is never used nor imported via the Phone logic.
How do I avoid this error and is there a better way to split the universal logic paths in this programmatically-created app?
That error is being triggered because you didn't weak-link the UIKit framework. The UIKit framework in iPhone OS 3.2 added the UISplitViewController, and if you link it in as normal your application will assume those symbols exist on 3.0, where they don't.
To weak-link a framework, find your application target in Xcode, inspect it, and go to the General tab. At the bottom of that tab should be a list of frameworks, with a column for Type. Change the Type for UIKit from Required to Weak and rebuild your application. That should take care of the runtime errors.
Your conditional logic is sound, but I tend to share an application delegate and do the interface-specific layout further down the line.
(Update: 12/21/2011) As of iOS 4.2, you should no longer need to weak link frameworks to prevent errors like this. As Marco Arment describes, if you build with iOS 4.2 or later and target down to iPhone OS 3.1+, individual classes are now weak linked and should have their +class method return nil if the class does not exist on the currently running version of the OS.
I was having a very similar error and it was driving me nuts! :-) Searching for hours and couldn't figure it out...
Like you said, everything was fine when running in the iPad Simulator but when trying to test the App on the iPhone with iPhone OS 3.1.2 it would not even start but crash with the following error message:
mi_cmd_stack_list_frames not enough frames in stack
By checking nearly every line of code I realised that the allocating of 3.2 classes like UIPopoverController or UISplitViewController (already inside forked iPad-specific code) was causing the problem.
So instead of i.e.:
infoPopover = [[UIPopoverController alloc] initWithContentViewController: infoNavController];
i would write
infoPopover = [[NSClassFromString(#"UIPopoverController") alloc] initWithContentViewController: infoNavController];
and that solved my problem! (Debugging can be so hard if the error message gives you no clue about where the bug could possibly be found...)
Xcode 8.3, iPad 2 (non retina), Swift 3 code
What helped for me was:
restart Xcode
do a 'Product -> Clean' ShiftCommandK
rebuild the project
After I've upgraded to Snow Leopard and Xcode 3.2, everything was screwed up. It took a while for me to figure out the whole evil was that my old Xcode installation was not really "updated", but replaced. So just everything was gone. All SDKs, Settings, everything.
So Code Sense did not work because of no SDK available, and all the other problems mentioned also just appeared because of that. So now, after re-installing all SDK's, Xcode seems to work fine. Well, almost: Simulator 2.2.1 is gone, which feels more like a punishment for upgrading fast to SL.
After all I decided to re-edit my question to prevent irritations. However, here in short what problems I had, so the answers still match:
1) The font was totally different
2) New Xcode didn't autocomplete CGRectMake and provided no parameter info, for instance. That was because of all missing SDK's and my wrong believe that it was an "upgrade" rather than a whole new replace.
3) New Xcode didn't highlight same symbols in scope. Same problem cause like above.
4) New Xcode never autocompleted anything. Same problem cause like above.
Off topic, but I feel everyone in the world must know:
The new Quicktime Player sucks. They removed all important controls like speed and sound tuning, which was always welcome on bad video trainings. Hopefully, they will add those important features again soon.
You are the first person I know of who feels that Xcode 3.2 is not a significant step forward. In response to your issues:
1) The new default font for Xcode is Menlo, as opposed to the previous Monaco. You can easily change this back under Xcode | Preferences | Fonts & Colors. Personally, I prefer Anonymous Pro or Inconsolata.
2) It sounds like your Code Sense index for your project might be messed up, causing the autocompletion issues that you're seeing. Click on the root of your project in Xcode, bring up the inspector, go to the General tab, and click on the Rebuild Code Sense Index button. I had this happen to me once, and that took care of the problem.
3) If I double-click on a symbol to highlight it, a dashed underline does appear below all instances of the symbol within the scope. As has been pointed out, right-clicking on the symbol will let you Edit All in Scope, a really nice addition to the editor.
4) See 2) above.
As far as the Quicktime Player, you can install the old Quicktime 7 as an optional player so that you can gain back some of the functionality that hasn't made it into the new player. The whole point of the new player is to start from scratch with the video playback frameworks, enabling much better performance (my MacBook Air can play 720p video without stuttering now). The missing functionality will be added back in, as it was with the new iMovie.
The point of Snow Leopard was not to remove capabilities, but to refine what was there and to strip out obsolete elements. In the case of Xcode 3.2, they added the integrated Clang LLVM compiler team, the integrated Clang Static Analyzer (worth the upgrade alone), a much improved documentation browser, and many new capabilities to the editor (like the Edit All in Scope mentioned above).
As far as iPhone OS 2.x support, you can build for it in Snow Leopard, but the Snow Leopard version of the iPhone Simulator only runs the 3.x OS. Apple clearly wants you to target the 3.x OS going forward.
1) Change the font in the Xcode preferences.
2) Xcode preferences "Code Sense"
3) Select the symbol and hover over it, after a short delay a small grey triangle appears to the right of the symbol, left click on it and select "Edit All in Scope". Not quite the same.
4) Same as 2 above.
Both 2 and 4 work for me, I must have different preference settings.
I use Mac OS X 10.6.1 and Xcode 3.2:
My fonts are nice
Works for me
Works for me
Maybe you should try to reinstall.
As noted, all of the things you list can be addressed with preference settings in XCode - for #3, check your setting for "Edit All In Scope" under "Code Sense" in Settings.