Building with CoreLocation framework, simulator and device - iphone

How can I add a reference the CoreLocation framework to my app and get it to compile for both the Simulator and a device without needing to delete and re-add the frame when switching platforms?
I'm writing a multi player game. Sometimes I test by putting my app on a device and also in the simulator and debug in simulator side. But I've recently added some CoreLocation services to my app and when I switch the platform from Simulator to Device, I need to remove the CoreLocation reference and re-add it from a different location. Then, when switching back to Simulator, I need to do it again.
I understand why. I'm just wondering if there are any tricks or tips which might help me automate this.

if you add it with relative path, it will point to the right base sdk when you switch between simulator and device.
When you do "add exiting frameworks", there is a window that tells you reference type, it should be Default (which should point to Relative to Current SDK)
then when you change the SDK to device or simulator it will look from the active SDK frameworks folder.

You have to add the framework by double-clicking the target, open the general tab, pressing the plus-button below the "liked-libraries" section.

Something is going wrong here, you do NOT have to remove and re-add frameworks between testing on the device and simulator (working with the iPhone keychain will only work on device).
Look at the image below, do you see the little tiny grey icon on the lower left hand corner of the toolbox. This indicates that the framework is "linked" correctly. If you do not see an icon with the little tiny grey circle like icon on the toolbox then you are not selecting
"add" > "Existing framework" in Xcode.
NOTE this image is for MKMapKit not corelocation, just used to illustrate what a correctly linked framework should look like.

I guess it's not that complicated. You can drag both the simulator framework and the device framework into an XCode project and it works. I'll remove the Simulator one before shipping, but it works for debugging.

I'm new to XCode development and ran into the same problem that you did.
There are several ways to add a framework to a project: dragging and dropping into the frameworks folder; adding to the linked libraries in the target's info page; etc. I found that the easiest way to add a framework to a project is the right click on the Frameworks folder in the "Groups and Files" Tab and choose "Add>Existing Frameworks"
When you select a framework it will be added relative to the SDK - If you open the frameworks' "info" window (ctrl-click> Get Info) after adding it, the path-type will be set to "Relative to current SDK")

Related

ios11 iphone app icon is missing on iPad

I have an iPhone only app but it works in compatibility mode in the iPad too(no surprises).
but after I updated the app for the ios11, app icon on the iPad is missing.
here is what I've tried;
- launch on the iPhone simulator, icon appears
- launch on the iPad simulator, icon is missing
change the device options from "iphone" to "universal", run the iPad simulator, icon appears but app needs a new iPad ui.
change back to "iPhone" and the app icon is missing again in iPad. really confusing.
I tried to create a new project and make the same changes but never able to make the icon missing again.
I'm using cocoa pods if that makes any sense.
I think I'm missing a settings or something else, I'm really trying to find it, any advice would be greatly appreciated.
I've found the problem.
In info.plist, there was an extra or problematic entry.
- CFBundleIcons~ipad
Remove this line and iPad icons appear normally.
This problem has been reported by many users over the past 6 months (including desperate pleas to Apple to fix this bug), yet no one's reported the following solution.
I'm using Xcode 9.2, and I noticed today that my iPad/iPhone's application will run fine on my iPad (iOS v11.2.1) but the icon is missing.
This is a legacy app, about 2-3 years old, and the cause seems to be my Appicon file. When I view this file, I see this:
Previously, this resource was sufficient to provide the app icon for both the iPad and iPhone, but apparently, not anymore.
I went into my Images.xcassets file, right-clicked, and selected "App Icons & Launch Images\New IOS App Icon" and now have a look at the extra icon possibilities:
Notice the extra icons for iPads.
Sure enough, I created yet more .png files, with resolutions matching the desired iPad resolutions settings, and now, when I build my app and run it on the iPad, it does show the correct icon.
Oh, and I also needed to go into my project's build settings, select the "General" tab, and change the "App Icons Source" to the name of my new image set, "AppIconNew".
Et voila. No messing around with Cocoapods, no need to change the .plist file (mine didn't have that "CFBundleIcons~ipad" entry anyway), I just needed to create a new image set.
Okay, time to go back to my modern, cosy world of using Visual Studio again now.
(Happy sigh..)
I've had a few legacy apps that did have the CFBundleIcons~ipad in the Info.plist, so I check that first. However, I've also had instances where it was just missing the asset as #Mike Gledhill mentioned. If this is the case, you don't have to go through adding a new AppIcon set. Just check the iPad box in the Attributes Inspector for the current AppIcon assets and the iPad sizes will show in the current set. Then just add the correct assets for each size requirement.
I didn't have CFBundleIcons~ipad entry in my Info.plist file as per "karpat"s answer. So I moved to "Mike Gledhill"s answer, then after observing my all the icons from Image assests, I found that for particular icon which was invisible only on iPad, the device type set was iPhone.
I just changed device type by right cling on image set to Universal :
This did work for me.

Universal application has black iPad screen

I've just finished my app for iPhone and it is working fine. I now want to make the app universal but am getting a black screen when running it on the iPad simulator. Here is what I have done so far:
When electing to make universal, I allowed xCode to create my "-iPad" version of my main nib; Therefore, I have MainWindow.xib for iPhone and MainWindow-iPad.xib for iPad. I have checked my plist file and have confirmed that both entries are present
Have double checked each UI component in the new iPad version to make sure all connections are made identically to the iPhone version. I also double check that the classes are correct
I have made sure that the "visible at launch" and "full screen at launch" options are selected
I read somewhere that removing the "-" worked for someone and have tried renaming my nib and plist entries
I am assuming that my app would then load the proper nib. Obviously I'm either wrong or have some configuration not right
On the other hand, if I need to make some change in my didFinishLoadingWithOptions to force they selection between my nibs - well I must admit I don't know how to accomplish this either.
Thanks!
If the app doesn't crash, than it means it can find the black screen.
Truncating the cache is done in Product -> Clean and also what you could try is "Reset" on the iOS simulator.
Further more, what you could check is if the "view" is linked correctly in your nib. (see image).
OK, after much trial and error, I have gotten this to work; Although, I'm not quite sure which exact steps solved the problem, I have a sneaking feeling it was some of the settings I had for the versioning of the app.
I created a new test app for iPhone and then converted it to iPad. Of course this worked unlike my app. I then compared everything I could think of between the apps. I changed the supported version from 3.1 to 4.0 on the Target -> Summary tab. I then check my build settings and changed everything in there to 4.0 as well. Finally, for each .xib file I set the deployment to "Project SDK Version (iOS 4.3) and the Development to "Interface Builder 3.1" because that is what my test app was set to. To be honest, I don't even recall altering these or do I really even know if this has an impact all I know is that I did change them as described. Did a project clean, reset the simulator and now it is working. I'm wondering if it was the 3.1 was too early for the iPad...
Anyway thanks.

Setting multiple icon files

I'm in the final stretch of submitting an application for distribution in the iTunes store, but I'm getting hung up on the icon files!
If I have only a 57x57 file, I get a warning in XCode and an error in Application Loader that I haven't provided a 72x72. If I set the 72x72's name to "Icon.png" instead of the 57x57, then it complains that it needs a 57x57 and chokes on the Application Load step.
Apple has addressed this already at:
http://developer.apple.com/iphone/library/qa/qa2010/qa1686.html#IPHONEADDITEMS, but those instructions are failing when I try to follow them: No disclosure arrow ever appears next to the "Icon files" key once I've added it, so the method there for adding multiple icons is failing for me.
On a related note, I don't actually WANT the 72x72 icon for iPad. I've set the application properties to iPhone only, yet it continues to demand the 72x72 icon in addition to the 57x57.
You can get the disclosure arrow to appear by clicking the icon on the far right side of the row when it's selected to get the first one, then click the plus to get the next one. That is really the recommended way of doing it. Apple actually recommends 57x57 (iPhone), 114x114 (iPhone4), 72x72 (iPad), and 512x512 (Ad-Hoc Distribution) icons be in there.
Better yet, I sometimes find going to the new "Preview Release 2" of XCode 4 and using it to modify the Info.plist is the way to go-- a MUCH nicer editor and apparently forward and backward file compatibility. Then open it back up in XCode 3 and do your final compiles there.
If you don't care how your app looks on an iPad, the quick & dirty solution is to create a 72 by 72 pixel icon file (just copy and resize your current one using the Preview app) and include it in your project resources as Icon-72.png
Here were the assorted issues:
1) I had to manually set the type of CFBundleIconFiles to Array by right clicking on it after changing the name. However, that got rolled back as...
2) Application Loader's schizophrenic insistence that the sole icon be both 57x57 and 72x72 at the same time was because I had set the "Base SDK" to 3.2 in the Project properties, an OS version which is iPad only, at the same time that I set the "Targeted Device Family" to compile for iPhone only. The solution was to change the "Base SDK" to 4.0 but the "iPhone OS Deployment Target" to 3.1.3, while leaving iPhone as the "Targeted Device Family".
Now I'm compiling without warnings. The new hang up is that Application Loader just says there was an error communicating with the iTunes store. :P

Convert iPhone App to iPad App (Just The Easy Part)

I make a basic View-Based application for iPhone in XCode 3.2, but when I switch the emulator to the iPad, the application gets "framed" (not sure what the right term is):
iPhone App, Framed http://dl.dropbox.com/u/2652228/iphone-app-framed.png
If I adjust the width of the View(s), it has no effect. I cannot adjust the width of the "Window" in Interface Builder (it's greyed out, and adding another Window to replace it gives me another Window instance in which the size is still grayed out). How should I proceed?
In Xcode, choose Project -> Upgrade Current Target for iPad... And read the documentation for details. It's all described in there step by step.
If you are using Xcode 4 then:
Go to your Project Target Summary (Go to Project Navigator, Click on first horizontal project named row tab, then click on Targets and choose 'Summary' tab)
In Devices drop down choose iPad (take a look at other options in settings below if you are interested)
Now you can just run and see how you app will look on iPad.
Steps mentioned above are just a way to just scale your app to iPad resolution. But for a great app you might want to render app differently wrt device. You might want to code different ViewControllers for different devices.
You can read more on this here: iOS Developer Library - Creating a Universal App

iPhone app using openAL works in simulator, but not on device

I added the openAL framework to my app and I am using the sound engine that is in the demo CrashLanding. It works just fine on the simulator, but when I build it for my device, I get errors. It looks like the framework isn't added. I've tried: restarting xcode; delete the framework and add it in again; cleaning the target; restart the computer. It still works on the simulator, but the device setting won't even compile. Does anyone have any other ideas or am I doing something wrong?
Here's a more specific error, there are 17 right now:
"_alSourcePlay", referenced from:
SoundEngineEffect::PlaybackProc(void*) in SoundEngine.o
SoundEngineEffect::Start() in SoundEngine.o
Also, CrashLanding runs fine on my device.
Remove the OpenAL framework you added.
Go to one of the other frameworks in your project, say UIKit, right-click and "reveal in finder".
Drag the OpenAL you find there from the Finder window into XCode under Frameworks.
Now it will probably work... sometimes when you say "Add Existing Frameworks" it seems to choose a wrong directory, and you are probably adding the OS X OpenAL framework (which is fine for the simulator).