Unable to find necessary user location graphical assets (MapBox) - ios5

Do we need to manually import in main project the user location graphical assets from iOS MapBox SDK ?
If I try to show user location, I've got this error (built on iPhone 4s on iOS6 — same error is logged on simulator iOS 5.1)
if (!self.mapView.isUserLocationVisible) {
self.mapView.showsUserLocation = YES;
}
The exact error logged is :
[RMUserLocation initWithMapView:coordinate:andTitle:], /Users/franco/Apps/XXXX/Application/XXXX/Vendors/mapbox-ios-sdk/MapView/Map/RMUserLocation.m:24
2012-06-13 01:41:52.426 XXXX[2058:907] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to find necessary user location graphical assets (copy from MapView/Map/Resources)'
Thanks for your help.

I'm the developer of the SDK. There's not an easier solution, since the SDK builds as a static library and as such, can't contain graphical assets. One thing that you can do is just reference the assets, not necessarily copy them into your project, and use the actual files shipped with the SDK. But I put that NSAssert() in to avoid a situation where the dev wouldn't know why the user location wasn't showing up.
I should also add that, like Apple's MapKit, the isUserLocationVisible property is not for testing if the location is shown, but rather if it's on screen currently. So you should instead check showsUserLocation to determine whether to set showsUserLocation.

A solution found, is to add (copy) assets files from MapView/Map/Resources to my root project.
I thought the Header Search Paths (set to $(SRCROOT)/IntraMuros/Vendors/mapbox-ios-sdk) would make these assets available.
There is probably a cleaner way to do this.
Note that assets files are available in the MapView sub-project.

Related

Conditional header include in AS3

I have a Flash CC/AS3 document which I intend to deploy on both iOS and Android platforms.
What I need to do next is integrate the app with Facebook. What I thought was the most logical way would be to have a class which handles all of the Facebook interaction stuff and calls on the appropriate method whether we have compiled for Air for Android or Air for iOS. I don't think this would be too difficult to do.
The problem arose when I started playing around with Persistant Login. To accomplish this on iOS I need to include .ane files into my .fla. Fine, so at this point I duplicate the .fla and have 1 for Android and 1 for iOS (This was the plan all along).
So in the iOS app I next have to import com.sbhave.openUrl.*; which references an .ane file. I was hoping that I would be able to do something like
try{
import com.sbhave.openUrl.*;
}
catch(e){
//Set some constant to let us know that we are on android
}
The alternative (I think) would be to make all changes for iOS, do a diff and create a patch to quickly swap in and out the iOS native extensions at build time. Does anybody have any suggesions how I can catch a failed import, or import conditionally based on whether or not the .ane file is present.
Thanks
PS..
OH yeh, I forgot to mention the reason this is so important is that the Air for iOS can't be ran on my PC with the extensions included, and it is a lot of work compiling + installing every time I need to test.
PPS..
This problem isn't specific to Facebook Persistent log in as there are other native extensions which will be required for various bits. The focus of the question is whether tha AS3 code can conditionally include a header file or process different includes based on paramaters set in the .FLA
For anyone else having a similar problem I have resolved this by doing the following:
I created a compile-time Constant that CONFIG::iOS which I set to true in the iOS app and False in Android.
Any code that relies on 3rdparty .ane or .swc files being included is enclosed in a block like
CONFIG::iOS
{
//iOS Specific
}
Thanks to http://divillysausages.com/blog/as3_conditional_compilation

InAppSettingKit custom bundle is not recognized on device

I set up InAppSettingsKit and wish to have only certain volatile settings available from within the app. These would not be the same as what is found in settings.app from springboard. I added a bundle, InAppSettings.Bundle and created the appropriate plist files. It works as expected in the simulator but acts as though my new bundle does not exist on the device. The device shows only the same as the settings.app properties in settings.bundle/ root.plist.
How do I get the new bundle into users' devices without deleting and reinstalling the app?
In this case, it was a "case" of developer error. Apparently the case of the characters in the name of a file are not specific in the simulator. The files in my bundle were not correctly named. I had root.inApp.plist when it should have been Root.inApp.plist. Worked in simulator,not on the device.
Once I realized this and renamed the file, the device read and displayed the correct file as intended.
That was a waste of about 5 hours chasing my tale. I Hope this info helps someone avoid this same annoying oversight.

Iphone app sharing file with iTunes problem

Somebody please help me out. This problem is killing me.
I went through tones of documents and posts. All seems to suggest that simply add a UIFileSharing key into info.plist and set boolean value to YES, files in App's Documents folder (not sub-folder, I know) will show up in iTunes.
However my problem is that I don't have an iPhone, so I really have no clue about what exactly the behaviors of both iPhone or iTunes will be when try to verify this file sharing thing. And what is the right way to verify this.
So when my client try to verify this off my watch (we are on different sides of earth), he keeps reporting back that file sharing feature not work. It is certain that file is properly stored under Documents folder.
In the last attempt, he claimed that he can see the app but not files.
I would like to know the following things, so I can guide him through this and end this pain:
Is it really plain and simple like add one key, no changes to code needed? Or did I miss something?
Are there any special requirements for building (like, only work for release build?), deploying?
What will really happen when plug the iPhone into the computer and sync with iTunes? Will the app show up in the Apps tab anyway, or only show up if file sharing feature are enabled correctly?
Thank you all.
Is it really plain and simple like add one key, no changes to code needed? Or did I miss something?
Yes
Are there any special requirements for building (like, only work for release build?), deploying?
No
What will really happen when plug the iPhone into the computer and sync with iTunes? Will the app show up in the Apps tab anyway, or only show up if file sharing feature are enabled correctly?
It will show up in the app view (on top) all the times. But you will only see them in the file sharing area if you have an app with enabled filesharing.
File sharing is only available on iPhone OS 4 onwards and iPad 3.2
Make sure your client has iOS4 or later.

iphone app upgrade and moved xibs/nibs leads to stale resources

I have an unlocalized shipping app which has foo.xib in the main project directory. In preparation for localization, I moved this to en.lproj/foo.xib. Now, when I build my app and install on my test device, it ends up using the stale old foo.nib which must be there from before (the installation process must not remove old files in the app's bundle). Deleting the app from the test device and re-installing fixes it -- but I don't want my existing customers to have to do that.
Some of these are coming from calls to UIViewController's -initWithNibName:bundle method (to which I'm currently passing nil for the nibBundle). I can probably create an NSBundle instance here which points at the correct localized directory. The others are specified in Info.plist or in the "NIB Name" section in interface builder and I don't see a way to specify a bundle for those.
It might just be easier to rename all my xibs to (e.g.) en.lproj/newfoo.xib, then I presume it will find the correct nib at runtime. (And I'll have to remember to never again use the old "foo.xib" name in a new version.) Is there a more clever solution here though? (Other than going back in time and starting with en.lproj directories from the beginning ;-)
Thanks!
-Mike
Answering my own question in case anyone else runs into this issue. It appears that this is an artifact of the Xcode build-publish cycle, and it isn't a problem when user's upgrade via the App Store. I went ahead and published my update and no one has noticed problems that would result from stale resources.
As a speedup to development, it appears that Xcode only copies over resources that it detects have changed when you build and install to the simulator or a test device. (To prevent a game with 500MB of resources from having to be re-copied each and every time you build and test.) When you (re)move a resource from a project though, it does not detect this and (re)move the old copy. I will file a bug with Apple about it.
However, the App store does appear to do a clean install with each upgrade (copying over the user's documents directory) so this is not a problem from the App Store. I'm not sure if it is a problem when emailing beta testers an .ipa file or not.
I'm having the same issue. The problem is that the phone keeps a cache of the nibs. Somehow thus cache needs to be cleared for you to see the new localized nibs. I also don't want my users to have to delete the app since it stores data.
I just had the same issue but found a solution which works, even with Xcode's deployment quirkiness: Prevent UIViewController loading stale XIB from app bundle

How do I add a third party Framework to iPhone project?

I am trying to use the PLDatabase framework in my iPhone app. I've added the framework to my Xcode project. However, when I run my app, it crashes with the following error:
dyld: Library not loaded: #loader_path/../Frameworks/PlausibleDatabase.framework/Versions/A/PlausibleDatabase
Referenced from: /Users/todd/Library/Application Support/iPhone Simulator/User/Applications/BB3C66B2-A5BB-4329-B163-AB0072411AF1/Congress.app/Congress
Reason: image not found
I'm not sure exactly where the Framework needs to reside on disk to be found.
Thanks
iPhone does not support dynamic linking of embedded frameworks. While you might be able to finagle the simulator to work, it will not work on the device. If you want to use the code you must build the static library for the framework (libpldatabase.a), and then link them to the app.
The Xcode GUI does not provide a nice interface for static linking, you will need to add appropriate flags in your build prefs (-lpldatabase -L/whatever/dir/it/is/in).
It's not actually strictly true that the iPhone doesn't support dynamic linking. What is true is that applications installed by the App Store are unable to dynamically link.
The app store / ituned installs programs into the /private/var/mobile/... directory. Any program opened that lives in that subdirectory is chrooted and has certain rights stripped away when opened. The chrooted processes can't fork, they can't run in the background, they can't load dynamic libraries and they can't save files outside of their little protected areas of the disk (with the exception of photos to the photo directory).
That said, the iPhone runs a modern operating system that supports dynamic linking just fine. The act of 'jailbreaking' is actually installing a program outside the chroot jail that can then do things like fork and save files to other places on the disk and load dynamic code.
Apple (and the open iPhone community) has plenty of programs running on the phone (such as the MobilePhone, Mobile Safari and SpringBoard applications) that can run in the background and load libraries. They are placed in a different place on the disk (/private/var/stash/Applications often).
So... if you want to sell your app in the app store, you can't load a dynamic library. Which for most people means you can't load it at all. But if you want to distribute your app through cydia (a common jailbroken phone app installer), then you can get away with jailbreaking the phone and loading your dynaamic library. In fact, due to the itunes install process being the culprit, as you've learned, you cant even load a dylib from your own app that you write to you own phone... unless you jailbreak.
RE #mipadi: ZeroLink was removed in Xcode 3.1 and does not exist for the iPhone SDK. The correct answer is Louis'; the iPhone does not support dynamically-loaded frameworks in developer-created applications.
Xcode does have a good user interface for static libraries; just drag them into the project and they're added to the link phase. No need to fuss with linker flags. The problem comes when you need to use the headers supplied with those static libs (then you need to add the header search paths manually) or when a static lib conflicts with an available dylib (that's when you have to add the -l flag manually).