¡@

Home 

2014/10/15 ¤U¤È 10:13:40

iphone Programming Glossary: script

Apple PNS (push notification services) sample code

http://stackoverflow.com/questions/1052645/apple-pns-push-notification-services-sample-code

testing you can just kick the deviceToken to the console with NSLog then paste it into the python script above in production you'll obviously need to set up some method to get the token to your servers. Also..

iPhone sending POST with NSURLConnection

http://stackoverflow.com/questions/2071788/iphone-sending-post-with-nsurlconnection

sending POST with NSURLConnection I'm having some problems with sending POST data to a PHP script with NSURLConnection. This is my code const char bytes NSString stringWithFormat @ xml version 1.0 n.. @ xml version 1.0 n mydata @ mydata data UTF8String NSURL url NSURL URLWithString @ http myurl.com script.php NSMutableURLRequest request NSMutableURLRequest requestWithURL url request setHTTPMethod @ POST.. request returningResponse response error err NSLog @ responseData @ responseData And my script.php is as simple as this php echo _POST 'mydata' This have worked for me in the past but for some reason..

How do I reset the scale/zoom of a web app on an orientation change on the iPhone?

http://stackoverflow.com/questions/2557801/how-do-i-reset-the-scale-zoom-of-a-web-app-on-an-orientation-change-on-the-iphon

I am trying to figure out if this is a bug or if this is something that can be fixed with Javascript With the viewport meta content I am setting the initial scale to 1.0 and I am NOT setting minimum or.. people would be grateful to have a solution as it seems to be a persistent problem. Thank you javascript iphone ipad orientation share improve this question Jeremy Keith @adactio has a good solution for.. meta name viewport content width device width initial scale 1 Then disable scalability with javascript on load until gesturestart when you allow scalability again with this script if navigator.userAgent.match..

Remove HTML Tags from an NSString on the iPhone

http://stackoverflow.com/questions/277055/remove-html-tags-from-an-nsstring-on-the-iphone

Cookbook chapter on the same subject would break this method IMG SRC foo.gif ALT A B A comment script if a b a c script INCLUDE CDATA iphone objective c cocoa touch share improve this question A quick.. on the same subject would break this method IMG SRC foo.gif ALT A B A comment script if a b a c script INCLUDE CDATA iphone objective c cocoa touch share improve this question A quick and dirty removes..

Autoplay audio files on an iPad with HTML5

http://stackoverflow.com/questions/3009888/autoplay-audio-files-on-an-ipad-with-html5

For Offline HTML sites it's a great feature and thats what I've used it for. Here is a javascript fake click solution http www.roblaplaca.com examples html5AutoPlay Copy Pasted Code from the site script.. fake click solution http www.roblaplaca.com examples html5AutoPlay Copy Pasted Code from the site script type text javascript function fakeClick fn var a ' a href # id fakeClick a ' a.bind click function.. http www.roblaplaca.com examples html5AutoPlay Copy Pasted Code from the site script type text javascript function fakeClick fn var a ' a href # id fakeClick a ' a.bind click function e e.preventDefault..

Build fat static library (device + simulator) using Xcode and SDK 4+

http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

work http www.drobnik.com touch 2010 04 universal static libraries There's some bugs in his script that means it only works on his machine he should be using BUILT_PRODUCTS_DIR and or BUILD_DIR instead.. term solution it converts your library into a Framework . RECENT CHANGES Info on how to use this script with a project embedded in another project although I highly recommend NOT doing that ever Apple has.. bugs in Xcode if you embed projects inside each other from Xcode 3.x through to Xcode 4.6.x Bonus script to let you auto include Bundles i.e. include PNG files PLIST files etc from your library see below scroll..

How to distribute ios application wirelessly without managing UDIDs and recompilation

http://stackoverflow.com/questions/5546581/how-to-distribute-ios-application-wirelessly-without-managing-udids-and-recompil

file. Viola they are running your program. Let me know if this works without the enterprise subscription. I imagine it would as long as the .mobileprovision file contained the device ID's. Edit I've found.. 'app' . .plist points to the php server file location of your .ipa files. when you call this php script you pass in the name of the ipa file you want to install. Note this location doesn't actually contain..

Re-sign IPA (iPhone)

http://stackoverflow.com/questions/6896029/re-sign-ipa-iphone

possible to control with the codesign tool or is it possible to re sign with xcrun With my resign script i currently do unzip app.ipa appname ls Payload xcrun sdk iphoneos PackageApplication s provisioning_profile..

Apple PNS (push notification services) sample code

http://stackoverflow.com/questions/1052645/apple-pns-push-notification-services-sample-code

NSError error During testing you can just kick the deviceToken to the console with NSLog then paste it into the python script above in production you'll obviously need to set up some method to get the token to your servers. Also in production you'll need to query Apple's feedback service..

iPhone sending POST with NSURLConnection

http://stackoverflow.com/questions/2071788/iphone-sending-post-with-nsurlconnection

sending POST with NSURLConnection I'm having some problems with sending POST data to a PHP script with NSURLConnection. This is my code const char bytes NSString stringWithFormat @ xml version 1.0 n mydata @ mydata data UTF8String NSURL url NSURL URLWithString.. This is my code const char bytes NSString stringWithFormat @ xml version 1.0 n mydata @ mydata data UTF8String NSURL url NSURL URLWithString @ http myurl.com script.php NSMutableURLRequest request NSMutableURLRequest requestWithURL url request setHTTPMethod @ POST request setHTTPBody NSData dataWithBytes bytes length strlen.. NSError err NSData responseData NSURLConnection sendSynchronousRequest request returningResponse response error err NSLog @ responseData @ responseData And my script.php is as simple as this php echo _POST 'mydata' This have worked for me in the past but for some reason the output I get from NSLog @ responseData @ responseData..

How do I reset the scale/zoom of a web app on an orientation change on the iPhone?

http://stackoverflow.com/questions/2557801/how-do-i-reset-the-scale-zoom-of-a-web-app-on-an-orientation-change-on-the-iphon

scale is correct when the orientation changes back to portrait. I am trying to figure out if this is a bug or if this is something that can be fixed with Javascript With the viewport meta content I am setting the initial scale to 1.0 and I am NOT setting minimum or maximum scale nor do I want to . I am setting the width to.. the width to device width. Any ideas I know a lot of people would be grateful to have a solution as it seems to be a persistent problem. Thank you javascript iphone ipad orientation share improve this question Jeremy Keith @adactio has a good solution for this on his blog Orientation and scale Keep the Markup scalable.. the Markup scalable by not setting a maximum scale in markup. meta name viewport content width device width initial scale 1 Then disable scalability with javascript on load until gesturestart when you allow scalability again with this script if navigator.userAgent.match iPhone i navigator.userAgent.match iPad i var viewportmeta..

Remove HTML Tags from an NSString on the iPhone

http://stackoverflow.com/questions/277055/remove-html-tags-from-an-nsstring-on-the-iphone

for very trivial cases. For example these cases from the Perl Cookbook chapter on the same subject would break this method IMG SRC foo.gif ALT A B A comment script if a b a c script INCLUDE CDATA iphone objective c cocoa touch share improve this question A quick and dirty removes everything between and solution works.. cases. For example these cases from the Perl Cookbook chapter on the same subject would break this method IMG SRC foo.gif ALT A B A comment script if a b a c script INCLUDE CDATA iphone objective c cocoa touch share improve this question A quick and dirty removes everything between and solution works with iOS 3.2 NSString..

Autoplay audio files on an iPad with HTML5

http://stackoverflow.com/questions/3009888/autoplay-audio-files-on-an-ipad-with-html5

use on mobile networks. I wouldn't use autoplay for online content. For Offline HTML sites it's a great feature and thats what I've used it for. Here is a javascript fake click solution http www.roblaplaca.com examples html5AutoPlay Copy Pasted Code from the site script type text javascript function fakeClick fn var a ' a href.. and thats what I've used it for. Here is a javascript fake click solution http www.roblaplaca.com examples html5AutoPlay Copy Pasted Code from the site script type text javascript function fakeClick fn var a ' a href # id fakeClick a ' a.bind click function e e.preventDefault fn body .append a var evt el #fakeClick.. I've used it for. Here is a javascript fake click solution http www.roblaplaca.com examples html5AutoPlay Copy Pasted Code from the site script type text javascript function fakeClick fn var a ' a href # id fakeClick a ' a.bind click function e e.preventDefault fn body .append a var evt el #fakeClick .get 0 if document.createEvent..

Build fat static library (device + simulator) using Xcode and SDK 4+

http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

This is a great idea it's an excellent approach but it doesn't work http www.drobnik.com touch 2010 04 universal static libraries There's some bugs in his script that means it only works on his machine he should be using BUILT_PRODUCTS_DIR and or BUILD_DIR instead of guesstimating them Apple's latest Xcode prevents you from.. 153422 takes much more effort to setup but much nicer long term solution it converts your library into a Framework . RECENT CHANGES Info on how to use this script with a project embedded in another project although I highly recommend NOT doing that ever Apple has a couple of show stopper bugs in Xcode if you embed projects.. NOT doing that ever Apple has a couple of show stopper bugs in Xcode if you embed projects inside each other from Xcode 3.x through to Xcode 4.6.x Bonus script to let you auto include Bundles i.e. include PNG files PLIST files etc from your library see below scroll to bottom now supports iPhone5 using Apple's workaround..

How to distribute ios application wirelessly without managing UDIDs and recompilation

http://stackoverflow.com/questions/5546581/how-to-distribute-ios-application-wirelessly-without-managing-udids-and-recompil

download and install the .mobileprovision file then the .ipa file. Viola they are running your program. Let me know if this works without the enterprise subscription. I imagine it would as long as the .mobileprovision file contained the device ID's. Edit I've found a much better way of distributing apps but it requires you.. file set the headers like this pathToAddFi installers . _GET 'app' . .plist points to the php server file location of your .ipa files. when you call this php script you pass in the name of the ipa file you want to install. Note this location doesn't actually contain any plist files root http yourserver.com php root path to..

Re-sign IPA (iPhone)

http://stackoverflow.com/questions/6896029/re-sign-ipa-iphone

profile as I do with my normal builds using xcrun is this possible to control with the codesign tool or is it possible to re sign with xcrun With my resign script i currently do unzip app.ipa appname ls Payload xcrun sdk iphoneos PackageApplication s provisioning_profile project_dir Payload appname o project_dir app resigned.ipa..

Apple PNS (push notification services) sample code

http://stackoverflow.com/questions/1052645/apple-pns-push-notification-services-sample-code

NSError error During testing you can just kick the deviceToken to the console with NSLog then paste it into the python script above in production you'll obviously need to set up some method to get the token to your servers. Also in production you'll..

iPhone sending POST with NSURLConnection

http://stackoverflow.com/questions/2071788/iphone-sending-post-with-nsurlconnection

sending POST with NSURLConnection I'm having some problems with sending POST data to a PHP script with NSURLConnection. This is my code const char bytes NSString stringWithFormat @ xml version 1.0 n mydata @ mydata data.. stringWithFormat @ xml version 1.0 n mydata @ mydata data UTF8String NSURL url NSURL URLWithString @ http myurl.com script.php NSMutableURLRequest request NSMutableURLRequest requestWithURL url request setHTTPMethod @ POST request setHTTPBody.. sendSynchronousRequest request returningResponse response error err NSLog @ responseData @ responseData And my script.php is as simple as this php echo _POST 'mydata' This have worked for me in the past but for some reason the output I get..

How do I reset the scale/zoom of a web app on an orientation change on the iPhone?

http://stackoverflow.com/questions/2557801/how-do-i-reset-the-scale-zoom-of-a-web-app-on-an-orientation-change-on-the-iphon

back to portrait. I am trying to figure out if this is a bug or if this is something that can be fixed with Javascript With the viewport meta content I am setting the initial scale to 1.0 and I am NOT setting minimum or maximum scale nor do.. I know a lot of people would be grateful to have a solution as it seems to be a persistent problem. Thank you javascript iphone ipad orientation share improve this question Jeremy Keith @adactio has a good solution for this on his blog Orientation.. scale in markup. meta name viewport content width device width initial scale 1 Then disable scalability with javascript on load until gesturestart when you allow scalability again with this script if navigator.userAgent.match iPhone i navigator.userAgent.match..

Remove HTML Tags from an NSString on the iPhone

http://stackoverflow.com/questions/277055/remove-html-tags-from-an-nsstring-on-the-iphone

cases from the Perl Cookbook chapter on the same subject would break this method IMG SRC foo.gif ALT A B A comment script if a b a c script INCLUDE CDATA iphone objective c cocoa touch share improve this question A quick and dirty removes.. Perl Cookbook chapter on the same subject would break this method IMG SRC foo.gif ALT A B A comment script if a b a c script INCLUDE CDATA iphone objective c cocoa touch share improve this question A quick and dirty removes everything between..

Autoplay audio files on an iPad with HTML5

http://stackoverflow.com/questions/3009888/autoplay-audio-files-on-an-ipad-with-html5

for online content. For Offline HTML sites it's a great feature and thats what I've used it for. Here is a javascript fake click solution http www.roblaplaca.com examples html5AutoPlay Copy Pasted Code from the site script type text javascript.. Here is a javascript fake click solution http www.roblaplaca.com examples html5AutoPlay Copy Pasted Code from the site script type text javascript function fakeClick fn var a ' a href # id fakeClick a ' a.bind click function e e.preventDefault.. fake click solution http www.roblaplaca.com examples html5AutoPlay Copy Pasted Code from the site script type text javascript function fakeClick fn var a ' a href # id fakeClick a ' a.bind click function e e.preventDefault fn body .append a..

Build fat static library (device + simulator) using Xcode and SDK 4+

http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

approach but it doesn't work http www.drobnik.com touch 2010 04 universal static libraries There's some bugs in his script that means it only works on his machine he should be using BUILT_PRODUCTS_DIR and or BUILD_DIR instead of guesstimating.. but much nicer long term solution it converts your library into a Framework . RECENT CHANGES Info on how to use this script with a project embedded in another project although I highly recommend NOT doing that ever Apple has a couple of show stopper.. of show stopper bugs in Xcode if you embed projects inside each other from Xcode 3.x through to Xcode 4.6.x Bonus script to let you auto include Bundles i.e. include PNG files PLIST files etc from your library see below scroll to bottom now..

How to distribute ios application wirelessly without managing UDIDs and recompilation

http://stackoverflow.com/questions/5546581/how-to-distribute-ios-application-wirelessly-without-managing-udids-and-recompil

file then the .ipa file. Viola they are running your program. Let me know if this works without the enterprise subscription. I imagine it would as long as the .mobileprovision file contained the device ID's. Edit I've found a much better way.. installers . _GET 'app' . .plist points to the php server file location of your .ipa files. when you call this php script you pass in the name of the ipa file you want to install. Note this location doesn't actually contain any plist files root..

Re-sign IPA (iPhone)

http://stackoverflow.com/questions/6896029/re-sign-ipa-iphone

using xcrun is this possible to control with the codesign tool or is it possible to re sign with xcrun With my resign script i currently do unzip app.ipa appname ls Payload xcrun sdk iphoneos PackageApplication s provisioning_profile project_dir..

Is there a way to programmatically scroll to a PDF page within a UIWebView?

http://stackoverflow.com/questions/1927841/is-there-a-way-to-programmatically-scroll-to-a-pdf-page-within-a-uiwebview

there a way to programmatically scroll to a PDF page within a UIWebView It is possible to use JavaScript to set the pixel y offset of a UIWebView e.g. webView stringByEvaluatingJavaScriptFromString NSString stringWithFormat @.. It is possible to use JavaScript to set the pixel y offset of a UIWebView e.g. webView stringByEvaluatingJavaScriptFromString NSString stringWithFormat @ scrollTo 0 d offset So is there a way to get The pixel height of an individual page.. height gap between pages or the pixel height of an individual page I can calculate the offset to use with the JavaScript call. Then I just wire up a UIButton or UISlider to move between pages. EDIT I I have a solution but it uses UIWebDocumentView..

Implementing Unit Testing with the iPhone SDK

http://stackoverflow.com/questions/2002330/implementing-unit-testing-with-the-iphone-sdk

code 1 as well as the error message the unit test has created. Then when I expand on the first error I get this PhaseScriptExecution Run Script build 3D Pool.build Debug iphonesimulator LogicTests.build Script 1A6BA6AE10F28F40008AC2A8.sh cd Users.. the error message the unit test has created. Then when I expand on the first error I get this PhaseScriptExecution Run Script build 3D Pool.build Debug iphonesimulator LogicTests.build Script 1A6BA6AE10F28F40008AC2A8.sh cd Users james Desktop FYP.. the first error I get this PhaseScriptExecution Run Script build 3D Pool.build Debug iphonesimulator LogicTests.build Script 1A6BA6AE10F28F40008AC2A8.sh cd Users james Desktop FYP 3D Pool setenv ACTION build setenv ALTERNATE_GROUP staff ... setenv..

Receive message “A signed resource has been added, modified, or deleted” when trying to debug an App on iPhone

http://stackoverflow.com/questions/2157964/receive-message-a-signed-resource-has-been-added-modified-or-deleted-when-tr

Make sure you have selected Device in the dropdown overview menu. In XCode go to Project New target... Then find Shell Script target under MacOSX Other Name it and add it to the current project Now in the left navigation panel under targets expand.. project Now in the left navigation panel under targets expand your newly created target and double click on Run Script. In the window that opens replace # shell script goes here with rm fr build Debug iphoneos .app without the quotes . Now..

SenTestCase in Xcode 3.2 and XCBuildLogCommandInvocationSection Errors

http://stackoverflow.com/questions/3516745/sentestcase-in-xcode-3-2-and-xcbuildlogcommandinvocationsection-errors

it began so gets very confused and chokes. One work around that I found somewhere on Google is to change the Run Script stage of the target. Change SYSTEM_DEVELOPER_DIR Tools RunUnitTests to SYSTEM_DEVELOPER_DIR Tools RunUnitTests 1 tmp RunUnitTests.out..

Build fat static library (device + simulator) using Xcode and SDK 4+

http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

set Build Active Architecture Only to NO for all items In Build Phases tab select Add ... New Build Phase ... New Run Script Build Phase Copy paste the script above into the box ...BONUS OPTIONAL usage OPTIONAL if you have headers in your library.. Wallner open CREATING_UNIVERSAL_DIR Apple deletes all output after 200 lines. Select your Target and in the Run Script Phase you MUST untick Show environment variables in build log if you're using a custom build output directory for XCode4.. to include non sourcecode files in your project PNG PLIST XML etc Do everything above check it works Create a new Run Script phase that comes AFTER THE FIRST ONE copy paste the code below Create a new Target in Xcode of type bundle In your MAIN..

Running script only for an 'Archive' build in Xcode 4

http://stackoverflow.com/questions/5471396/running-script-only-for-an-archive-build-in-xcode-4

script only for an 'Archive' build in Xcode 4 I have a script that I run using osascript from a Run Script Build Phase in Xcode 4. This script does some checks to try and catch any human error in plists and suchlike. However I.. as opposed to running it every time they build. Is there any way of testing for this situation Either in Shell Script or Apple Script iphone xcode xcode4 share improve this question In Xcode 4 you could run this script as a pre or post.. to running it every time they build. Is there any way of testing for this situation Either in Shell Script or Apple Script iphone xcode xcode4 share improve this question In Xcode 4 you could run this script as a pre or post action script..

Version vs build in XCode 4

http://stackoverflow.com/questions/6851660/version-vs-build-in-xcode-4

Select the Build Phases tab. In Xcode 4 at the bottom right click the Add Build Phase button and select Add Run Script . In Xcode 5 select Editor menu Add Build Phase Add Run Script Build Phase . Drag and drop the new Run Script phase to move.. click the Add Build Phase button and select Add Run Script . In Xcode 5 select Editor menu Add Build Phase Add Run Script Build Phase . Drag and drop the new Run Script phase to move it to just before the Copy Bundle Resources phase when the.. Add Run Script . In Xcode 5 select Editor menu Add Build Phase Add Run Script Build Phase . Drag and drop the new Run Script phase to move it to just before the Copy Bundle Resources phase when the app info.plist file will be bundled with your app..